feat(student-portal): 完整实现 student-portal 微前端
包含 src 全部实现、Dockerfile、配置文件、contracts 包等
This commit is contained in:
20
apps/student-portal/src/mocks/server.ts
Normal file
20
apps/student-portal/src/mocks/server.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* MSW 服务端 setup(ai14)
|
||||
*
|
||||
* 用于 Node.js 环境(Vitest 集成测试 / SSR)拦截 GraphQL 请求。
|
||||
* 通过 setupServer 注册 handler,在测试 beforeEach 中启动、afterEach 中停止。
|
||||
*
|
||||
* 用法:
|
||||
* import { server } from "@/mocks/server";
|
||||
* beforeAll(() => server.listen());
|
||||
* afterEach(() => server.resetHandlers());
|
||||
* afterAll(() => server.close());
|
||||
*/
|
||||
|
||||
import { setupServer } from "msw/node";
|
||||
import { handlers } from "./handlers";
|
||||
|
||||
/** MSW Node.js server 单例 */
|
||||
export const server = setupServer(...handlers);
|
||||
|
||||
export { handlers };
|
||||
Reference in New Issue
Block a user