Public Access
feat(play-next): pick games by mood
This commit is contained in:
1 parent
7d9cf907fc
commit
fa1bd59509
4 files changed
+111
-13
No files matched your search
@@ -69,6 +69,47 @@ describe('PlayNextPage', () => {
|
||||
expect(pickerUrls()[1].has('exclude')).toBe(false);
|
||||
});
|
||||
|
||||
it('asks for games of the chosen mood and keeps the length', async () => {
|
||||
mockBackend([[game(1)], [game(2)], [game(3)]]);
|
||||
renderPage();
|
||||
await screen.findByText('Game 1');
|
||||
fireEvent.click(screen.getByRole('button', {name: 'PLAY_NEXT.BUDGET.SHORT'}));
|
||||
await screen.findByText('Game 2');
|
||||
|
||||
fireEvent.click(screen.getByRole('button', {name: 'PLAY_NEXT.MOOD.COOP'}));
|
||||
|
||||
expect(await screen.findByText('Game 3')).toBeTruthy();
|
||||
expect(pickerUrls()[2].get('mood')).toBe('COOP');
|
||||
expect(pickerUrls()[2].get('maxMinutes')).toBe('300');
|
||||
expect(screen.getByRole('button', {name: 'PLAY_NEXT.MOOD.COOP'}).getAttribute('aria-pressed')).toBe('true');
|
||||
});
|
||||
|
||||
it('sends no mood for any mood and rerolls within the mood', async () => {
|
||||
mockBackend([[game(1)], [game(2)], [game(3)]]);
|
||||
renderPage();
|
||||
await screen.findByText('Game 1');
|
||||
expect(pickerUrls()[0].has('mood')).toBe(false);
|
||||
|
||||
fireEvent.click(screen.getByRole('button', {name: 'PLAY_NEXT.MOOD.STORY'}));
|
||||
await screen.findByText('Game 2');
|
||||
fireEvent.click(screen.getByRole('button', {name: 'PLAY_NEXT.REROLL'}));
|
||||
|
||||
await screen.findByText('Game 3');
|
||||
expect(pickerUrls()[2].get('mood')).toBe('STORY');
|
||||
expect(pickerUrls()[2].getAll('exclude')).toEqual(['2']);
|
||||
});
|
||||
|
||||
it('suggests another mood when none of the backlog fits', async () => {
|
||||
mockBackend([[game(1)], []]);
|
||||
renderPage();
|
||||
await screen.findByText('Game 1');
|
||||
|
||||
fireEvent.click(screen.getByRole('button', {name: 'PLAY_NEXT.MOOD.SCARY'}));
|
||||
|
||||
expect(await screen.findByText('PLAY_NEXT.EMPTY_MOOD')).toBeTruthy();
|
||||
expect(screen.getByText('PLAY_NEXT.MOOD_HINT')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('drops the old picks when a new budget fails to load', async () => {
|
||||
mockBackend([[game(1)]]);
|
||||
const pickerFetch = globalThis.fetch;
|
||||
|
||||
Reference in new issue
Block a user