mirror of
https://github.com/civitai/civitai.git
synced 2026-09-20 22:08:18 +08:00
fix(next16): move v1 images API test out of src/pages
Next 16's route-type validator treats every file under src/pages as a route and requires a `default` export, so the test added in #2423 at src/pages/api/v1/images/__tests__/index.test.ts failed typecheck/build ("does not satisfy ApiRouteConfig"). Moved it to src/tests/api/v1/images/ (still matched by vitest's `src/**/*.test.ts`) and switched the handler import to the `~/` alias. vi.mock calls already used `~/`, so behavior is unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
import "./.next/dev/types/routes.d.ts";
|
||||
import "./.next/types/routes.d.ts";
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ vi.mock('~/server/utils/endpoint-helpers', () => ({
|
||||
}));
|
||||
|
||||
// 2. Import the handler after the mocks are defined
|
||||
import handler from '../index';
|
||||
import handler from '~/pages/api/v1/images/index';
|
||||
|
||||
// 3. Helper to mock NextApiRequest/Response
|
||||
function createMocks({ query = {} }: { query?: Record<string, string | string[]> }) {
|
||||
Reference in New Issue
Block a user