yuwen
2025-11-12 3f575f22e2943845bb9b617e2592abba39c909b0
引用
作者 yuwen <yuwen@i-mps.com>
星期三, 十一月 12, 2025 14:53 +0800
確認提交者 yuwen <yuwen@i-mps.com>
星期五, 十一月 14, 2025 14:58 +0800
提交3f575f22e2943845bb9b617e2592abba39c909b0
目錄 337b6c96a4cefa675693135e26982087d397db84 目錄 | zip | gz
上個版本 4eddb3a0fd83027e2a16bf817394ace44d405154 檢視 | 差異
feat: integrate MSW for API mocking and testing

- Added MSW (Mock Service Worker) for intercepting network requests in development and testing.
- Created mock data and handlers for example API responses.
- Implemented a new ExamplePage component with a button to trigger API requests.
- Updated router to include a route for the ExamplePage.
- Added tests for ExamplePage using Testing Library and Vitest, ensuring proper rendering and API interaction.
- Configured testing setup to clean up after tests and start the MSW server.
- Updated package.json to include necessary dependencies for testing and mocking.
修改8個檔案
新增13個檔案
3490 ■■■■■ 已變更過的檔案
.github/instructions/testing.instructions.md 363 ●●●●● 差異 | 檢視 | 原始 | 究查 | 歷程
docs/testing-guide.md 451 ●●●●● 差異 | 檢視 | 原始 | 究查 | 歷程
e2e/features/example/user-flow.spec.ts 79 ●●●●● 差異 | 檢視 | 原始 | 究查 | 歷程
package-lock.json 1898 ●●●●● 差異 | 檢視 | 原始 | 究查 | 歷程
package.json 10 ●●●●● 差異 | 檢視 | 原始 | 究查 | 歷程
public/mockServiceWorker.js 349 ●●●●● 差異 | 檢視 | 原始 | 究查 | 歷程
setupTests.ts 21 ●●●●● 差異 | 檢視 | 原始 | 究查 | 歷程
src/App.vue 2 ●●●●● 差異 | 檢視 | 原始 | 究查 | 歷程
src/__tests__/App.spec.ts 8 ●●●● 差異 | 檢視 | 原始 | 究查 | 歷程
src/features/example/api.ts 12 ●●●●● 差異 | 檢視 | 原始 | 究查 | 歷程
src/features/example/index.spec.ts 176 ●●●●● 差異 | 檢視 | 原始 | 究查 | 歷程
src/features/example/index.vue 55 ●●●●● 差異 | 檢視 | 原始 | 究查 | 歷程
src/main.ts 6 ●●●● 差異 | 檢視 | 原始 | 究查 | 歷程
src/mocks/browser.ts 4 ●●●● 差異 | 檢視 | 原始 | 究查 | 歷程
src/mocks/data/example.ts 10 ●●●●● 差異 | 檢視 | 原始 | 究查 | 歷程
src/mocks/data/index.ts 7 ●●●●● 差異 | 檢視 | 原始 | 究查 | 歷程
src/mocks/handlers.ts 21 ●●●●● 差異 | 檢視 | 原始 | 究查 | 歷程
src/mocks/node.ts 4 ●●●● 差異 | 檢視 | 原始 | 究查 | 歷程
src/router/index.ts 11 ●●●●● 差異 | 檢視 | 原始 | 究查 | 歷程
tsconfig.app.json 2 ●●● 差異 | 檢視 | 原始 | 究查 | 歷程
vitest.config.ts 1 ●●●● 差異 | 檢視 | 原始 | 究查 | 歷程