forked from acacode/swagger-typescript-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
39 lines (36 loc) · 1.2 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const { generateApiForTest } = require("../../helpers/generateApiForTest");
const { resolve } = require("path");
const validateGeneratedModule = require("../../helpers/validateGeneratedModule");
const createSchemaInfos = require("../../helpers/createSchemaInfos");
const assertGeneratedModule = require("../../helpers/assertGeneratedModule");
const schemas = createSchemaInfos({ absolutePathToSchemas: resolve(__dirname, "./") });
schemas.forEach(({ absolutePath, Exception }) => {
generateApiForTest({
testName: "--modular option test",
silent: true,
input: absolutePath,
output: resolve(__dirname, "./generated"),
modular: true,
generateClient: true,
generateRouteTypes: true,
}).then(() => {
const outputFileNames = [
"data-contracts",
"http-client",
"Key",
"KeyRoute",
"Login",
"LoginRoute",
"route-types",
"Scope",
"ScopeRoute",
];
for (const fileName of outputFileNames) {
validateGeneratedModule(resolve(__dirname, `./generated/${fileName}.ts`));
assertGeneratedModule(
resolve(__dirname, `./generated/${fileName}.ts`),
resolve(__dirname, `./expected/${fileName}.ts`),
);
}
});
});