mirror of
https://github.com/ferdikoomen/openapi-typescript-codegen.git
synced 2026-01-25 16:02:59 +00:00
fixed tests
This commit is contained in:
parent
e408c7d81d
commit
fc485636a4
131
package-lock.json
generated
131
package-lock.json
generated
@ -60,7 +60,7 @@
|
||||
"glob": "13.0.0",
|
||||
"jest": "30.2.0",
|
||||
"jest-cli": "30.2.0",
|
||||
"node-fetch": "3.3.2",
|
||||
"node-fetch": "2.7.0",
|
||||
"prettier": "3.7.4",
|
||||
"puppeteer": "24.34.0",
|
||||
"qs": "6.14.0",
|
||||
@ -10342,13 +10342,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/data-uri-to-buffer": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz",
|
||||
"integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==",
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz",
|
||||
"integrity": "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 12"
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
@ -11635,30 +11635,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/fetch-blob": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz",
|
||||
"integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/jimmywarting"
|
||||
},
|
||||
{
|
||||
"type": "paypal",
|
||||
"url": "https://paypal.me/jimmywarting"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"node-domexception": "^1.0.0",
|
||||
"web-streams-polyfill": "^3.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20 || >= 14.13"
|
||||
}
|
||||
},
|
||||
"node_modules/file-entry-cache": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz",
|
||||
@ -11833,19 +11809,6 @@
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/formdata-polyfill": {
|
||||
"version": "4.0.10",
|
||||
"resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz",
|
||||
"integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fetch-blob": "^3.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.20.0"
|
||||
}
|
||||
},
|
||||
"node_modules/forwarded": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
||||
@ -12056,16 +12019,6 @@
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/get-uri/node_modules/data-uri-to-buffer": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz",
|
||||
"integrity": "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/glob": {
|
||||
"version": "13.0.0",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-13.0.0.tgz",
|
||||
@ -15112,44 +15065,25 @@
|
||||
"license": "MIT",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/node-domexception": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
|
||||
"integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==",
|
||||
"deprecated": "Use your platform's native DOMException instead",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/jimmywarting"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://paypal.me/jimmywarting"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/node-fetch": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz",
|
||||
"integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==",
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
|
||||
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"data-uri-to-buffer": "^4.0.0",
|
||||
"fetch-blob": "^3.1.4",
|
||||
"formdata-polyfill": "^4.0.10"
|
||||
"whatwg-url": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
"node": "4.x || >=6.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/node-fetch"
|
||||
"peerDependencies": {
|
||||
"encoding": "^0.1.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"encoding": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/node-forge": {
|
||||
@ -18212,27 +18146,6 @@
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/teeny-request/node_modules/node-fetch": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
|
||||
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"whatwg-url": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.x || >=6.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"encoding": "^0.1.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"encoding": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/terser": {
|
||||
"version": "5.44.0",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.44.0.tgz",
|
||||
@ -19562,16 +19475,6 @@
|
||||
"license": "MIT",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/web-streams-polyfill": {
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz",
|
||||
"integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/webdriver-bidi-protocol": {
|
||||
"version": "0.3.10",
|
||||
"resolved": "https://registry.npmjs.org/webdriver-bidi-protocol/-/webdriver-bidi-protocol-0.3.10.tgz",
|
||||
|
||||
@ -108,7 +108,7 @@
|
||||
"glob": "13.0.0",
|
||||
"jest": "30.2.0",
|
||||
"jest-cli": "30.2.0",
|
||||
"node-fetch": "3.3.2",
|
||||
"node-fetch": "2.7.0",
|
||||
"prettier": "3.7.4",
|
||||
"puppeteer": "24.34.0",
|
||||
"qs": "6.14.0",
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import puppeteer, { Browser, EvaluateFn, Page } from 'puppeteer';
|
||||
import puppeteer, { Browser, EvaluateFunc, Page } from 'puppeteer';
|
||||
|
||||
let _browser: Browser;
|
||||
let _page: Page;
|
||||
@ -8,8 +8,7 @@ const start = async () => {
|
||||
// and load the localhost page, this page will load the
|
||||
// javascript modules (see server.js for more info)
|
||||
_browser = await puppeteer.launch({
|
||||
headless: 'new',
|
||||
args: ['--no-sandbox', '--disable-setuid-sandbox'],
|
||||
headless: true,
|
||||
});
|
||||
_page = await _browser.newPage();
|
||||
// _page.on('console', msg => console.log(msg.text()));
|
||||
@ -19,15 +18,15 @@ const start = async () => {
|
||||
};
|
||||
|
||||
const stop = async () => {
|
||||
await _page.close();
|
||||
await _browser.close();
|
||||
await _page?.close();
|
||||
await _browser?.close();
|
||||
};
|
||||
|
||||
const evaluate = async (fn: EvaluateFn) => {
|
||||
const evaluate = async <T extends unknown[]>(fn: EvaluateFunc<T>) => {
|
||||
return await _page.evaluate(fn);
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
||||
const exposeFunction = async (name: string, fn: Function) => {
|
||||
return await _page.exposeFunction(name, fn);
|
||||
};
|
||||
|
||||
@ -8,7 +8,7 @@ export const createAngularProject = (dir: string, name: string) => {
|
||||
recursive: true,
|
||||
});
|
||||
|
||||
sync('ng', ['analytics', 'off', '--global'], {
|
||||
sync('ng', ['analytics', 'disable', '--global'], {
|
||||
cwd: resolvePath(cwd),
|
||||
stdio: 'inherit',
|
||||
});
|
||||
@ -18,6 +18,8 @@ export const createAngularProject = (dir: string, name: string) => {
|
||||
[
|
||||
'new',
|
||||
name,
|
||||
'--ai-config',
|
||||
'none',
|
||||
'--minimal',
|
||||
'true',
|
||||
'--style',
|
||||
|
||||
@ -65,7 +65,7 @@ const start = async (dir: string) => {
|
||||
// Register an 'echo' server that just returns all data from the API calls.
|
||||
// Although this might not be a 'correct' response, we can use this to test
|
||||
// the majority of API calls.
|
||||
_app.all('/base/api/v1.0/*', (req, res) => {
|
||||
_app.all('/base/api/v1.0/*path', (req, res) => {
|
||||
setTimeout(() => {
|
||||
res.json({
|
||||
method: req.method,
|
||||
@ -87,7 +87,7 @@ const start = async (dir: string) => {
|
||||
|
||||
const stop = async () => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
_server.close(err => {
|
||||
_server?.close(err => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
|
||||
@ -57,7 +57,7 @@ describe('v3.axios', () => {
|
||||
'valuePath',
|
||||
{
|
||||
prop: 'valueBody',
|
||||
}
|
||||
},
|
||||
);
|
||||
expect(result).toBeDefined();
|
||||
});
|
||||
@ -104,7 +104,7 @@ describe('v3.axios', () => {
|
||||
status: 500,
|
||||
message: 'hello world',
|
||||
},
|
||||
})
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@ -136,7 +136,7 @@ describe('v3.axios', () => {
|
||||
status: 409,
|
||||
message: 'hello world',
|
||||
},
|
||||
})
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@ -147,6 +147,10 @@ describe('v3.axios', () => {
|
||||
size: 1,
|
||||
sort: ['location'],
|
||||
})) as Promise<any>;
|
||||
expect((result as any).query).toStrictEqual({ parameter: { page: '0', size: '1', sort: 'location' } });
|
||||
expect((result as any).query).toStrictEqual({
|
||||
'parameter[page]': '0',
|
||||
'parameter[size]': '1',
|
||||
'parameter[sort]': 'location',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -126,7 +126,7 @@ describe('v3.babel', () => {
|
||||
status: 500,
|
||||
message: 'hello world',
|
||||
},
|
||||
})
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@ -162,7 +162,7 @@ describe('v3.babel', () => {
|
||||
status: 409,
|
||||
message: 'hello world',
|
||||
},
|
||||
})
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@ -177,6 +177,10 @@ describe('v3.babel', () => {
|
||||
},
|
||||
})) as Promise<any>;
|
||||
});
|
||||
expect(result.query).toStrictEqual({ parameter: { page: '0', size: '1', sort: 'location' } });
|
||||
expect(result.query).toStrictEqual({
|
||||
'parameter[page]': '0',
|
||||
'parameter[size]': '1',
|
||||
'parameter[sort]': 'location',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -69,7 +69,7 @@ describe('v3.fetch', () => {
|
||||
'valuePath',
|
||||
{
|
||||
prop: 'valueBody',
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
expect(result).toBeDefined();
|
||||
@ -122,7 +122,7 @@ describe('v3.fetch', () => {
|
||||
status: 500,
|
||||
message: 'hello world',
|
||||
},
|
||||
})
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@ -156,7 +156,7 @@ describe('v3.fetch', () => {
|
||||
status: 409,
|
||||
message: 'hello world',
|
||||
},
|
||||
})
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@ -169,6 +169,10 @@ describe('v3.fetch', () => {
|
||||
sort: ['location'],
|
||||
})) as Promise<any>;
|
||||
});
|
||||
expect(result.query).toStrictEqual({ parameter: { page: '0', size: '1', sort: 'location' } });
|
||||
expect(result.query).toStrictEqual({
|
||||
'parameter[page]': '0',
|
||||
'parameter[size]': '1',
|
||||
'parameter[sort]': 'location',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -57,7 +57,7 @@ describe('v3.node', () => {
|
||||
'valuePath',
|
||||
{
|
||||
prop: 'valueBody',
|
||||
}
|
||||
},
|
||||
);
|
||||
expect(result).toBeDefined();
|
||||
});
|
||||
@ -104,7 +104,7 @@ describe('v3.node', () => {
|
||||
status: 500,
|
||||
message: 'hello world',
|
||||
},
|
||||
})
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@ -136,7 +136,7 @@ describe('v3.node', () => {
|
||||
status: 409,
|
||||
message: 'hello world',
|
||||
},
|
||||
})
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@ -147,6 +147,10 @@ describe('v3.node', () => {
|
||||
size: 1,
|
||||
sort: ['location'],
|
||||
})) as Promise<any>;
|
||||
expect((result as any).query).toStrictEqual({ parameter: { page: '0', size: '1', sort: 'location' } });
|
||||
expect((result as any).query).toStrictEqual({
|
||||
'parameter[page]': '0',
|
||||
'parameter[size]': '1',
|
||||
'parameter[sort]': 'location',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -168,6 +168,10 @@ describe('v3.xhr', () => {
|
||||
sort: ['location'],
|
||||
})) as Promise<any>;
|
||||
});
|
||||
expect(result.query).toStrictEqual({ parameter: { page: '0', size: '1', sort: 'location' } });
|
||||
expect(result.query).toStrictEqual({
|
||||
'parameter[page]': '0',
|
||||
'parameter[size]': '1',
|
||||
'parameter[sort]': 'location',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user