提交 744a8039 authored 作者: 王鹏飞's avatar 王鹏飞

docs: strengthen learning state proof

上级 d96aed69
......@@ -885,7 +885,7 @@ describe('useLibraryQueryState', () => {
it('restores typed state from the URL', () => {
const { result } = renderHook(() => useLibraryQueryState(), {
wrapper: withNuqsTestingAdapter({
searchParams: '?q=AI&category=12&sort=latest&page=2&tab=all',
searchParams: '?q=AI&category=12&sort=latest&page=2&tab=all&dialog=book&bookId=100',
}),
})
......@@ -895,6 +895,8 @@ describe('useLibraryQueryState', () => {
sort: 'latest',
page: 2,
tab: 'all',
dialog: 'book',
bookId: '100',
})
})
......@@ -920,13 +922,14 @@ Create `apps/learning/src/modules/library/query.test.ts`:
```ts
import { describe, expect, it } from 'vitest'
import { libraryKeys } from './query'
import type { LibrarySearchState } from './query-state'
describe('libraryKeys', () => {
it('includes server inputs and excludes dialog state', () => {
const state = {
q: 'AI', category: '12', sort: 'latest', page: 2,
tab: 'all' as const, dialog: 'book' as const, bookId: '100',
}
tab: 'all', dialog: 'book', bookId: '100',
} satisfies LibrarySearchState
expect(libraryKeys.list(state)).toEqual([
'library',
'list',
......@@ -1205,10 +1208,11 @@ Run:
```bash
pnpm test:learning
pnpm build:learning
pnpm lint:learning
test -f dist/learning/index.html
```
Expected: all tests pass and the build exits 0.
Expected: all tests, lint, and the build exit 0.
- [ ] **Step 8: Verify forbidden state dependencies are absent**
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论