bigbuffet-rw/app/soapbox/components/__tests__/quoted-status.test.tsx

31 lines
893 B
TypeScript
Raw Normal View History

2022-06-08 09:25:41 -07:00
import React from 'react';
import { render, screen, rootState } from '../../jest/test-helpers';
import { normalizeStatus, normalizeAccount } from '../../normalizers';
import QuotedStatus from '../quoted-status';
2022-07-06 11:12:35 -07:00
import type { ReducerStatus } from 'soapbox/reducers/statuses';
2022-06-08 09:25:41 -07:00
describe('<QuotedStatus />', () => {
it('renders content', () => {
const account = normalizeAccount({
id: '1',
acct: 'alex',
2023-07-15 18:25:39 -07:00
url: 'https://soapbox.test/users/alex',
2022-06-08 09:25:41 -07:00
});
const status = normalizeStatus({
id: '1',
account,
content: 'hello world',
contentHtml: 'hello world',
2022-07-06 11:12:35 -07:00
}) as ReducerStatus;
2022-06-08 09:25:41 -07:00
2022-07-06 11:12:35 -07:00
const state = rootState.setIn(['accounts', '1'], account);
2022-06-08 09:25:41 -07:00
2022-07-06 11:12:35 -07:00
render(<QuotedStatus status={status} />, undefined, state);
2022-06-08 09:25:41 -07:00
screen.getByText(/hello world/i);
expect(screen.getByTestId('quoted-status')).toHaveTextContent(/hello world/i);
});
});