Public Access
feat(dashboard): Steam avatar and a banner from the most played game
This commit is contained in:
1 parent
2c360c9421
commit
23e502bf5b
11 files changed
+222
-37
No files matched your search
@@ -0,0 +1,25 @@
|
||||
// @vitest-environment jsdom
|
||||
import {afterEach, describe, expect, it} from 'vitest';
|
||||
import {cleanup, fireEvent, render} from '@testing-library/react';
|
||||
import SteamAvatar from './SteamAvatar.jsx';
|
||||
|
||||
afterEach(cleanup);
|
||||
|
||||
describe('SteamAvatar', () => {
|
||||
it('shows the avatar and the default icon when it does not load', () => {
|
||||
const {container} = render(<SteamAvatar url="https://avatars.steamstatic.com/a_full.jpg"/>);
|
||||
expect(container.querySelector('img').getAttribute('src')).toBe('https://avatars.steamstatic.com/a_full.jpg');
|
||||
|
||||
fireEvent.error(container.querySelector('img'));
|
||||
|
||||
expect(container.querySelector('img')).toBeNull();
|
||||
expect(container.querySelector('svg')).not.toBeNull();
|
||||
});
|
||||
|
||||
it('shows the default icon without an avatar', () => {
|
||||
const {container} = render(<SteamAvatar url={null}/>);
|
||||
|
||||
expect(container.querySelector('img')).toBeNull();
|
||||
expect(container.querySelector('svg')).not.toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user