mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
chore(core): skip supplement validation in unit test
This commit is contained in:
parent
f1150eca30
commit
5fa377dd24
2 changed files with 12 additions and 3 deletions
|
@ -72,6 +72,7 @@ describe('GET /swagger.json', () => {
|
|||
const testTagRouter = new Router();
|
||||
testTagRouter.get('/mock', () => ({}));
|
||||
testTagRouter.put('/.well-known', () => ({}));
|
||||
testTagRouter.put('/sso-connectors', () => ({}));
|
||||
const swaggerRequest = createSwaggerRequest([testTagRouter]);
|
||||
|
||||
const response = await swaggerRequest.get('/swagger.json');
|
||||
|
@ -80,7 +81,10 @@ describe('GET /swagger.json', () => {
|
|||
get: { tags: ['Mock'] },
|
||||
},
|
||||
'/api/.well-known': {
|
||||
put: { tags: ['Well known'] },
|
||||
put: { tags: ['Well-known'] },
|
||||
},
|
||||
'/api/sso-connectors': {
|
||||
put: { tags: ['SSO connectors'] },
|
||||
},
|
||||
});
|
||||
});
|
||||
|
|
|
@ -15,6 +15,7 @@ import type { WithGuardConfig } from '#src/middleware/koa-guard.js';
|
|||
import { isGuardMiddleware } from '#src/middleware/koa-guard.js';
|
||||
import { isPaginationMiddleware } from '#src/middleware/koa-pagination.js';
|
||||
import assertThat from '#src/utils/assert-that.js';
|
||||
import { consoleLog } from '#src/utils/console.js';
|
||||
import { translationSchemas, zodTypeToSwagger } from '#src/utils/zod.js';
|
||||
|
||||
import type { AnonymousRouter } from '../types.js';
|
||||
|
@ -219,9 +220,13 @@ export default function swaggerRoutes<T extends AnonymousRouter, R extends Route
|
|||
tags: [...tags].map((tag) => ({ name: tag })),
|
||||
};
|
||||
|
||||
if (EnvSet.values.isUnitTest) {
|
||||
consoleLog.warn('Skip validating supplement documents in unit test.');
|
||||
} else {
|
||||
for (const document of supplementDocuments) {
|
||||
validateSupplement(baseDocument, document);
|
||||
}
|
||||
}
|
||||
|
||||
const data = supplementDocuments.reduce(
|
||||
(document, supplement) => deepmerge(document, supplement, { arrayMerge: mergeParameters }),
|
||||
|
|
Loading…
Reference in a new issue