2022-06-14 08:58:42 -07:00
|
|
|
import React from 'react';
|
|
|
|
|
2023-05-02 16:49:13 -07:00
|
|
|
import { buildRelationship } from 'soapbox/jest/factory';
|
|
|
|
import { render, screen } from 'soapbox/jest/test-helpers';
|
|
|
|
import { normalizeAccount } from 'soapbox/normalizers';
|
|
|
|
|
2022-06-14 08:58:42 -07:00
|
|
|
import SubscribeButton from '../subscription-button';
|
|
|
|
|
2022-07-06 10:16:14 -07:00
|
|
|
import type { ReducerAccount } from 'soapbox/reducers/accounts';
|
|
|
|
|
|
|
|
const justin = {
|
2022-06-14 08:58:42 -07:00
|
|
|
id: '1',
|
|
|
|
acct: 'justin-username',
|
|
|
|
display_name: 'Justin L',
|
|
|
|
avatar: 'test.jpg',
|
|
|
|
};
|
|
|
|
|
|
|
|
describe('<SubscribeButton />', () => {
|
2022-07-06 10:16:14 -07:00
|
|
|
let store: any;
|
2022-06-14 08:58:42 -07:00
|
|
|
|
|
|
|
describe('with "accountNotifies" disabled', () => {
|
|
|
|
it('renders nothing', () => {
|
2023-05-02 16:49:13 -07:00
|
|
|
const account = normalizeAccount({ ...justin, relationship: buildRelationship({ following: true }) }) as ReducerAccount;
|
2022-06-14 08:58:42 -07:00
|
|
|
|
2022-07-06 10:16:14 -07:00
|
|
|
render(<SubscribeButton account={account} />, undefined, store);
|
2022-06-14 08:58:42 -07:00
|
|
|
expect(screen.queryAllByTestId('icon-button')).toHaveLength(0);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|