Files
AutoGPT/autogpt_platform/frontend/orval.config.ts
Abhimanyu Yadav b0953654d9 feat(frontend): add integration testing setup with Vitest, MSW, and RTL (#11813)
### Changes 🏗️

- Added Vitest and React Testing Library for frontend unit testing
- Configured MSW (Mock Service Worker) for API mocking in tests
- Created test utilities and setup files for integration tests
- Added comprehensive testing documentation in `AGENTS.md`
- Updated Orval configuration to generate MSW mock handlers
- Added mock server and browser implementations for development testing

### Checklist 📋

#### For code changes:
- [x] I have clearly listed my changes in the PR description
- [x] I have made a test plan
- [x] I have tested my changes according to the test plan:
  - [x] Run `pnpm test:unit` to verify tests pass
  - [x] Verify MSW mock handlers are generated correctly
  - [x] Check that test utilities work with sample component tests

#### For configuration changes:

- [x] `.env.default` is updated or already compatible with my changes
- [x] `docker-compose.yml` is updated or already compatible with my
changes
- [x] I have included a list of my configuration changes in the PR
description (under **Changes**)
2026-01-22 10:10:00 +00:00

116 lines
3.0 KiB
TypeScript

import { defineConfig } from "orval";
export default defineConfig({
autogpt_api_client: {
input: {
target: `./src/app/api/openapi.json`,
override: {
transformer: "./src/app/api/transformers/fix-tags.mjs",
},
},
output: {
workspace: "./src/app/api",
target: `./__generated__/endpoints`,
schemas: "./__generated__/models",
mode: "tags-split",
client: "react-query",
httpClient: "fetch",
indexFiles: false,
mock: {
type: "msw",
baseUrl: "http://localhost:3000/api/proxy",
generateEachHttpStatus: true,
delay: 0,
},
override: {
mutator: {
path: "./mutators/custom-mutator.ts",
name: "customMutator",
},
query: {
useQuery: true,
useMutation: true,
usePrefetch: true,
// Will add more as their use cases arise
},
useDates: true,
operations: {
"getV2List library agents": {
query: {
useInfinite: true,
useInfiniteQueryParam: "page",
},
},
"getV2List favorite library agents": {
query: {
useInfinite: true,
useInfiniteQueryParam: "page",
},
},
"getV2List presets": {
query: {
useInfinite: true,
useInfiniteQueryParam: "page",
},
},
"getV1List graph executions": {
query: {
useInfinite: true,
useInfiniteQueryParam: "page",
},
},
"getV2Get builder blocks": {
query: {
useInfinite: true,
useInfiniteQueryParam: "page",
useQuery: true,
},
},
"getV2Get builder integration providers": {
query: {
useInfinite: true,
useInfiniteQueryParam: "page",
},
},
"getV2List store agents": {
query: {
useInfinite: true,
useInfiniteQueryParam: "page",
useQuery: true,
},
},
"getV2Builder search": {
query: {
useInfinite: true,
useInfiniteQueryParam: "page",
},
},
},
},
},
hooks: {
afterAllFilesWrite:
"prettier --ignore-path= --write ./src/app/api/__generated__",
},
},
// autogpt_zod_schema: {
// input: {
// target: `./src/app/api/openapi.json`,
// override: {
// transformer: "./src/app/api/transformers/fix-tags.mjs",
// },
// },
// output: {
// workspace: "./src/app/api",
// target: `./__generated__/zod-schema`,
// schemas: "./__generated__/models",
// mode: "tags-split",
// client: "zod",
// indexFiles: false,
// },
// hooks: {
// afterAllFilesWrite: "prettier --write",
// },
// },
});