mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2026-11-19 01:13:34 +08:00
Add user CRUD, account-scoped navigation history and favorites. Unify HTTP mocks, backend contracts and route configuration. Reuse existing scrolling components and add Harness reuse guidance.
16 lines
609 B
TypeScript
16 lines
609 B
TypeScript
import { setupServer } from 'msw/node'
|
|
import { apiUrl } from '../apps/admin/src/api/admin/client'
|
|
import { createAdminDatabase } from '../apps/admin/src/mocks/database'
|
|
import { createAdminHandlers } from '../apps/admin/src/mocks/handlers'
|
|
|
|
if (typeof document !== 'undefined') {
|
|
const server = setupServer(
|
|
...createAdminHandlers(createAdminDatabase(), apiUrl('')),
|
|
)
|
|
|
|
// 部分旧 Hook 用例在 describe 收集阶段启动应用,拦截必须先于该阶段就绪。
|
|
server.listen({ onUnhandledRequest: 'bypass' })
|
|
afterEach(() => server.resetHandlers())
|
|
afterAll(() => server.close())
|
|
}
|