Public Access
feat(picker): add the speedrun mood and the speedrun.com link
"What to play next" gets a Speedrun mood. The game detail links the game's speedrun.com page when Core found one with verified runs; only https://www.speedrun.com/ links are shown.
This commit is contained in:
1 parent
b0c78d8dca
commit
23ab5a91e7
7 files changed
+82
-12
No files matched your search
@@ -35,6 +35,24 @@ afterEach(() => {
|
||||
});
|
||||
|
||||
describe('GameDetail', () => {
|
||||
it('links the speedrun.com page when Core found one', async () => {
|
||||
globalThis.fetch = vi.fn(async () => ({ok: true, status: 200,
|
||||
json: async () => ({...game, speedrunUrl: 'https://www.speedrun.com/hl2'})}));
|
||||
renderDetail();
|
||||
|
||||
const link = await screen.findByRole('link', {name: /GAME_DETAIL.OPEN_IN_SPEEDRUN/});
|
||||
expect(link.getAttribute('href')).toBe('https://www.speedrun.com/hl2');
|
||||
});
|
||||
|
||||
it.each([null, 'https://www.speedrun.com.evil.example/hl2', 'https://evil.example/hl2', 42])(
|
||||
'shows no speedrun link for %s', async (speedrunUrl) => {
|
||||
globalThis.fetch = vi.fn(async () => ({ok: true, status: 200, json: async () => ({...game, speedrunUrl})}));
|
||||
renderDetail();
|
||||
|
||||
await screen.findByText('GAME_DETAIL.OPEN_IN_STEAM');
|
||||
expect(screen.queryByText('GAME_DETAIL.OPEN_IN_SPEEDRUN')).toBeNull();
|
||||
});
|
||||
|
||||
it('keeps unsaved notes in the backlog card when the hint sets the game to playing', async () => {
|
||||
renderDetail();
|
||||
const notes = await screen.findByLabelText('BACKLOG.NOTES_LABEL');
|
||||
|
||||
Reference in new issue
Block a user