Keep it in rotation card (Feature 21) (#179)
CI / ci (push) Successful in 8m9s
CI / ci (pull_request) Successful in 9m23s

Co-authored-by: dev_agent <dev_agent@cubecraftlabs.com>
This commit was merged in pull request #179.
This commit is contained in:
2026-10-10 17:13:20 -04:00
committed by approver_agent
parent 837da07f3e
commit 62f4f9eece
10 changed files with 598 additions and 8 deletions
+8 -3
View File
@@ -3,10 +3,11 @@ import { createMemoryRouter, RouterProvider, useLocation } from 'react-router'
import { afterEach, describe, expect, it, vi } from 'vitest'
import { ApiProviders, HOME } from '../test/ApiProviders.tsx'
import { declaredStyle } from '../test/cssRules.ts'
import { errorResponse, jsonResponse, stubFetch, stubFetchByPath } from '../test/fetchStub.ts'
import { errorResponse, jsonResponse, stubFetchByPath } from '../test/fetchStub.ts'
import { expectMinHitArea } from '../test/hitArea.ts'
import { HOME_PATH } from './api.ts'
import { HomePage } from './HomePage.tsx'
import { ROTATION_REVIEWS_PATH } from './rotation.ts'
// NOTHING_YET is the home of a household with no plan, no Side quests, no
// Supply run and nothing unread.
@@ -29,7 +30,7 @@ function Where() {
}
function renderHome(body: unknown) {
stubFetchByPath({ [HOME_PATH]: () => jsonResponse(200, body) })
stubFetchByPath({ [HOME_PATH]: () => jsonResponse(200, body), [ROTATION_REVIEWS_PATH]: () => jsonResponse(200, { reviews: [] }) })
return renderRouter()
}
@@ -198,7 +199,11 @@ describe('HomePage', () => {
})
it('reports a failure with Retry, and no made-up content', async () => {
stubFetch(errorResponse(500, 'internal'), jsonResponse(200, HOME))
const homes = [errorResponse(500, 'internal'), jsonResponse(200, HOME)]
stubFetchByPath({
[HOME_PATH]: () => homes.shift()!,
[ROTATION_REVIEWS_PATH]: () => jsonResponse(200, { reviews: [] }),
})
renderRouter()
expect(await screen.findByRole('alert')).toHaveTextContent("Couldn't load tonight's quest. internal message")