bigbuffet-rw/app/soapbox/components/__tests__/avatar-overlay.test.tsx

32 lines
884 B
TypeScript
Raw Normal View History

import React from 'react';
2022-07-06 11:12:35 -07:00
import { normalizeAccount } from 'soapbox/normalizers';
import { render, screen } from '../../jest/test-helpers';
2022-11-15 06:10:14 -08:00
import AvatarOverlay from '../avatar-overlay';
2020-03-27 13:59:38 -07:00
2022-07-06 11:12:35 -07:00
import type { ReducerAccount } from 'soapbox/reducers/accounts';
2020-03-27 13:59:38 -07:00
describe('<AvatarOverlay', () => {
2022-07-06 11:12:35 -07:00
const account = normalizeAccount({
2020-03-27 13:59:38 -07:00
username: 'alice',
acct: 'alice',
display_name: 'Alice',
avatar: '/animated/alice.gif',
avatar_static: '/static/alice.jpg',
2022-07-06 11:12:35 -07:00
}) as ReducerAccount;
2020-03-27 13:59:38 -07:00
2022-07-06 11:12:35 -07:00
const friend = normalizeAccount({
2020-03-27 13:59:38 -07:00
username: 'eve',
acct: 'eve@blackhat.lair',
display_name: 'Evelyn',
avatar: '/animated/eve.gif',
avatar_static: '/static/eve.jpg',
2022-07-06 11:12:35 -07:00
}) as ReducerAccount;
2020-03-27 13:59:38 -07:00
it('renders a overlay avatar', () => {
render(<AvatarOverlay account={account} friend={friend} />);
expect(screen.queryAllByRole('img')).toHaveLength(2);
2020-03-27 13:59:38 -07:00
});
});