mirror of
https://github.com/Kong/insomnia
synced 2024-11-07 14:19:58 +00:00
chore(deps): upgrades jest to 28 (#4783)
This commit is contained in:
parent
db672f82a9
commit
52393eccc0
@ -3,7 +3,7 @@ module.exports = {
|
|||||||
collectCoverage: false,
|
collectCoverage: false,
|
||||||
globals: {
|
globals: {
|
||||||
'ts-jest': {
|
'ts-jest': {
|
||||||
isolatedModules: true,
|
isolatedModules: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
||||||
|
7261
package-lock.json
generated
7261
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -40,7 +40,8 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/plugin-proposal-decorators": "^7.4.0",
|
"@babel/plugin-proposal-decorators": "^7.4.0",
|
||||||
"@types/jest": "^26.0.23",
|
"@jest/types": "^28.1.0",
|
||||||
|
"@jest/globals": "^28.1.0",
|
||||||
"@types/node": "^17.0.21",
|
"@types/node": "^17.0.21",
|
||||||
"@types/svgo": "^2.6.3",
|
"@types/svgo": "^2.6.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.10.2",
|
"@typescript-eslint/eslint-plugin": "^5.10.2",
|
||||||
@ -56,13 +57,13 @@
|
|||||||
"eslint-plugin-react": "^7.28.0",
|
"eslint-plugin-react": "^7.28.0",
|
||||||
"eslint-plugin-react-hooks": "^4.3.0",
|
"eslint-plugin-react-hooks": "^4.3.0",
|
||||||
"eslint-plugin-simple-import-sort": "^7.0.0",
|
"eslint-plugin-simple-import-sort": "^7.0.0",
|
||||||
"jest": "^26.6.3",
|
"jest": "^28.1.0",
|
||||||
"lerna": "^4.0.0",
|
"lerna": "^4.0.0",
|
||||||
"markdownlint-cli2": "^0.2.0",
|
"markdownlint-cli2": "^0.2.0",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"svg-text-to-path": "^1.1.2",
|
"svg-text-to-path": "^1.1.2",
|
||||||
"svgo": "^2.8.0",
|
"svgo": "^2.8.0",
|
||||||
"ts-jest": "^26.5.6",
|
"ts-jest": "^28.0.1",
|
||||||
"type-fest": "^2.12.0",
|
"type-fest": "^2.12.0",
|
||||||
"typescript": "^4.5.5"
|
"typescript": "^4.5.5"
|
||||||
},
|
},
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
/** @type { import('@jest/types').Config.InitialOptions } */
|
/** @type { import('@jest/types').Config.InitialOptions } */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
preset: '../../jest-preset.js',
|
preset: '../../jest-preset.js',
|
||||||
globals: {
|
|
||||||
'ts-jest': {
|
|
||||||
isolatedModules: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
/** @type { import('@jest/types').Config.InitialOptions } */
|
/** @type { import('@jest/types').Config.InitialOptions } */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
preset: '../../jest-preset.js',
|
preset: '../../jest-preset.js',
|
||||||
|
globals: {
|
||||||
|
'ts-jest': {
|
||||||
|
isolatedModules: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fakeTimers: {
|
||||||
|
enableGlobally: true,
|
||||||
|
},
|
||||||
setupFilesAfterEnv: ['./src/jest/setup-after-env.ts'],
|
setupFilesAfterEnv: ['./src/jest/setup-after-env.ts'],
|
||||||
testEnvironment: 'jsdom',
|
testEnvironment: 'jsdom',
|
||||||
};
|
};
|
||||||
|
9767
packages/insomnia-components/package-lock.json
generated
9767
packages/insomnia-components/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -39,18 +39,19 @@
|
|||||||
"watch": "cross-env ESBUILD_WATCH=true esr esbuild.ts"
|
"watch": "cross-env ESBUILD_WATCH=true esr esbuild.ts"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@jest/globals": "^28.1.0",
|
||||||
"@svgr/cli": "^5.5.0",
|
"@svgr/cli": "^5.5.0",
|
||||||
"@testing-library/jest-dom": "^5.12.0",
|
"@testing-library/jest-dom": "^5.16.4",
|
||||||
"@testing-library/react": "^11.2.6",
|
"@testing-library/react": "^12.1.5",
|
||||||
"@types/ramda": "^0.27.44",
|
"@types/ramda": "^0.27.44",
|
||||||
"@types/react": "^17.0.39",
|
"@types/react": "^17.0.39",
|
||||||
"@types/react-dom": "^17.0.11",
|
"@types/react-dom": "^17.0.11",
|
||||||
"@types/testing-library__jest-dom": "^5.9.5",
|
|
||||||
"concurrently": "^7.0.0",
|
"concurrently": "^7.0.0",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"esbuild": "^0.14.27",
|
"esbuild": "^0.14.27",
|
||||||
"esbuild-runner": "^2.2.1",
|
"esbuild-runner": "^2.2.1",
|
||||||
"jest": "^26.6.3",
|
"jest": "^28.1.0",
|
||||||
|
"jest-environment-jsdom": "^28.0.2",
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
"react-use": "^17.2.4",
|
"react-use": "^17.2.4",
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
|
import { jest } from '@jest/globals';
|
||||||
import { ByRoleMatcher, ByRoleOptions, fireEvent, render } from '@testing-library/react';
|
import { ByRoleMatcher, ByRoleOptions, fireEvent, render } from '@testing-library/react';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { Tooltip } from './tooltip';
|
import { Tooltip } from './tooltip';
|
||||||
|
|
||||||
const pause = (time: number) => new Promise(resolve => setTimeout(resolve, time));
|
|
||||||
|
|
||||||
type QueryByRole = (
|
type QueryByRole = (
|
||||||
text: ByRoleMatcher,
|
text: ByRoleMatcher,
|
||||||
options?: ByRoleOptions | undefined,
|
options?: ByRoleOptions | undefined,
|
||||||
@ -32,14 +31,14 @@ describe('<Tooltip />', () => {
|
|||||||
fireEvent.mouseEnter(getByText(childText));
|
fireEvent.mouseEnter(getByText(childText));
|
||||||
|
|
||||||
// Should open after the configured delay, wait a sufficient amount
|
// Should open after the configured delay, wait a sufficient amount
|
||||||
await pause(delay * 2);
|
jest.advanceTimersByTime(delay * 2);
|
||||||
|
|
||||||
expect(getByRole('tooltip')).toBeTruthy();
|
expect(getByRole('tooltip')).toBeTruthy();
|
||||||
|
|
||||||
fireEvent.mouseLeave(getByText(childText));
|
fireEvent.mouseLeave(getByText(childText));
|
||||||
|
|
||||||
// Should close after 100ms default, wait a sufficient amount
|
// Should close after 100ms default, wait a sufficient amount
|
||||||
await pause(200);
|
jest.advanceTimersByTime(delay);
|
||||||
|
|
||||||
expect(getByRole('tooltip', { hidden: true })).toBeTruthy();
|
expect(getByRole('tooltip', { hidden: true })).toBeTruthy();
|
||||||
|
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
/** @type { import('@jest/types').Config.InitialOptions } */
|
/** @type { import('@jest/types').Config.InitialOptions } */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
preset: '../../jest-preset.js',
|
preset: '../../jest-preset.js',
|
||||||
globals: {
|
|
||||||
'ts-jest': {
|
|
||||||
isolatedModules: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
8327
packages/insomnia-config/package-lock.json
generated
8327
packages/insomnia-config/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -33,7 +33,7 @@
|
|||||||
"insomnia-common": "3.1.0-beta.1"
|
"insomnia-common": "3.1.0-beta.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"jest": "^26.6.3",
|
"jest": "^28.1.0",
|
||||||
"ts-node": "^10.2.1",
|
"ts-node": "^10.2.1",
|
||||||
"typescript": "^4.5.5",
|
"typescript": "^4.5.5",
|
||||||
"typescript-json-schema": "^0.50.1"
|
"typescript-json-schema": "^0.50.1"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { describe, expect, it } from '@jest/globals';
|
||||||
|
|
||||||
import { InsomniaConfig } from '.';
|
import { InsomniaConfig } from '.';
|
||||||
import { ingest, validate } from './validate';
|
import { ingest, validate } from './validate';
|
||||||
|
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
/** @type { import('@jest/types').Config.InitialOptions } */
|
/** @type { import('@jest/types').Config.InitialOptions } */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
preset: '../../jest-preset.js',
|
preset: '../../jest-preset.js',
|
||||||
|
globals: {
|
||||||
|
'ts-jest': {
|
||||||
|
isolatedModules: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
/** @type { import('@jest/types').Config.InitialOptions } */
|
/** @type { import('@jest/types').Config.InitialOptions } */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
preset: '../../jest-preset.js',
|
preset: '../../jest-preset.js',
|
||||||
|
globals: {
|
||||||
|
'ts-jest': {
|
||||||
|
isolatedModules: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
/** @type { import('@jest/types').Config.InitialOptions } */
|
/** @type { import('@jest/types').Config.InitialOptions } */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
preset: '../../jest-preset.js',
|
preset: '../../jest-preset.js',
|
||||||
|
globals: {
|
||||||
|
'ts-jest': {
|
||||||
|
isolatedModules: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
collectCoverage: true,
|
collectCoverage: true,
|
||||||
coveragePathIgnorePatterns: ['/node_modules/'],
|
coveragePathIgnorePatterns: ['/node_modules/'],
|
||||||
coverageThreshold: {
|
coverageThreshold: {
|
||||||
|
5560
packages/insomnia-inso/package-lock.json
generated
5560
packages/insomnia-inso/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -54,7 +54,7 @@
|
|||||||
"@types/yaml": "^1.9.7",
|
"@types/yaml": "^1.9.7",
|
||||||
"execa": "^5.0.0",
|
"execa": "^5.0.0",
|
||||||
"get-bin-path": "^5.1.0",
|
"get-bin-path": "^5.1.0",
|
||||||
"jest": "^26.6.3",
|
"jest": "^28.1.0",
|
||||||
"node-loader": "1.0.2",
|
"node-loader": "1.0.2",
|
||||||
"pkg": "^5.3.2",
|
"pkg": "^5.3.2",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
"node_modules",
|
"node_modules",
|
||||||
"dist",
|
"dist",
|
||||||
"src/jest",
|
"src/jest",
|
||||||
".babelrc.js",
|
|
||||||
"jest.config.js",
|
"jest.config.js",
|
||||||
"webpack",
|
"webpack",
|
||||||
"bin",
|
"bin",
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
/** @type { import('@jest/types').Config.InitialOptions } */
|
/** @type { import('@jest/types').Config.InitialOptions } */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
preset: '../../jest-preset.js',
|
preset: '../../jest-preset.js',
|
||||||
|
globals: {
|
||||||
|
'ts-jest': {
|
||||||
|
isolatedModules: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
// @ts-expect-error TSMIGRATION
|
|
||||||
jasmine.getEnv().addReporter({
|
|
||||||
// @ts-expect-error TSMIGRATION
|
|
||||||
specStarted: result => (jasmine.currentTest = result),
|
|
||||||
// @ts-expect-error TSMIGRATION
|
|
||||||
specDone: result => (jasmine.currentTest = result),
|
|
||||||
});
|
|
@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from '@jest/globals';
|
||||||
import execa from 'execa';
|
import execa from 'execa';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { getBinPathSync } from 'get-bin-path';
|
import { getBinPathSync } from 'get-bin-path';
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
/** @type { import('@jest/types').Config.InitialOptions } */
|
/** @type { import('@jest/types').Config.InitialOptions } */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
preset: '../../jest-preset.js',
|
preset: '../../jest-preset.js',
|
||||||
setupFilesAfterEnv: [
|
globals: {
|
||||||
'./__jest__/setup.ts',
|
'ts-jest': {
|
||||||
],
|
isolatedModules: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
8776
packages/insomnia-smoke-test/package-lock.json
generated
8776
packages/insomnia-smoke-test/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -45,7 +45,7 @@
|
|||||||
"express-basic-auth": "^1.2.0",
|
"express-basic-auth": "^1.2.0",
|
||||||
"faker": "^5.1.0",
|
"faker": "^5.1.0",
|
||||||
"get-bin-path": "^5.1.0",
|
"get-bin-path": "^5.1.0",
|
||||||
"jest": "^26.6.3",
|
"jest": "^28.1.0",
|
||||||
"mkdirp": "^1.0.4",
|
"mkdirp": "^1.0.4",
|
||||||
"oidc-provider": "^7.10.6",
|
"oidc-provider": "^7.10.6",
|
||||||
"ramda": "^0.27.1",
|
"ramda": "^0.27.1",
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
"server"
|
"server"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"dist"
|
"dist",
|
||||||
|
"**/*.test.ts",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,9 @@
|
|||||||
"playwright",
|
"playwright",
|
||||||
"server",
|
"server",
|
||||||
"jest.config.js",
|
"jest.config.js",
|
||||||
".eslintrc.js"
|
".eslintrc.js",
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"dist"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
/** @type { import('@jest/types').Config.InitialOptions } */
|
/** @type { import('@jest/types').Config.InitialOptions } */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
preset: '../../jest-preset.js',
|
preset: '../../jest-preset.js',
|
||||||
|
globals: {
|
||||||
|
'ts-jest': {
|
||||||
|
isolatedModules: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
369
packages/insomnia-testing/package-lock.json
generated
369
packages/insomnia-testing/package-lock.json
generated
@ -17,15 +17,75 @@
|
|||||||
"@types/chai": "^4.2.15",
|
"@types/chai": "^4.2.15",
|
||||||
"@types/mkdirp": "^1.0.1",
|
"@types/mkdirp": "^1.0.1",
|
||||||
"@types/mocha": "^8.2.1",
|
"@types/mocha": "^8.2.1",
|
||||||
|
"jest-mock": "^28.0.2",
|
||||||
"typescript": "^4.5.5"
|
"typescript": "^4.5.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@jest/schemas": {
|
||||||
|
"version": "28.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-28.0.2.tgz",
|
||||||
|
"integrity": "sha512-YVDJZjd4izeTDkij00vHHAymNXQ6WWsdChFRK86qck6Jpr3DCL5W3Is3vslviRlP+bLuMYRLbdp98amMvqudhA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@sinclair/typebox": "^0.23.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jest/types": {
|
||||||
|
"version": "28.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jest/types/-/types-28.1.0.tgz",
|
||||||
|
"integrity": "sha512-xmEggMPr317MIOjjDoZ4ejCSr9Lpbt/u34+dvc99t7DS8YirW5rwZEhzKPC2BMUFkUhI48qs6qLUSGw5FuL0GA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@jest/schemas": "^28.0.2",
|
||||||
|
"@types/istanbul-lib-coverage": "^2.0.0",
|
||||||
|
"@types/istanbul-reports": "^3.0.0",
|
||||||
|
"@types/node": "*",
|
||||||
|
"@types/yargs": "^17.0.8",
|
||||||
|
"chalk": "^4.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@sinclair/typebox": {
|
||||||
|
"version": "0.23.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.23.5.tgz",
|
||||||
|
"integrity": "sha512-AFBVi/iT4g20DHoujvMH1aEDn8fGJh4xsRGCP6d8RpLPMqsNPvW01Jcn0QysXTsg++/xj25NmJsGyH9xug/wKg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/@types/chai": {
|
"node_modules/@types/chai": {
|
||||||
"version": "4.2.15",
|
"version": "4.2.15",
|
||||||
"resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.15.tgz",
|
"resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.15.tgz",
|
||||||
"integrity": "sha512-rYff6FI+ZTKAPkJUoyz7Udq3GaoDZnxYDEvdEdFZASiA7PoErltHezDishqQiSDWrGxvxmplH304jyzQmjp0AQ==",
|
"integrity": "sha512-rYff6FI+ZTKAPkJUoyz7Udq3GaoDZnxYDEvdEdFZASiA7PoErltHezDishqQiSDWrGxvxmplH304jyzQmjp0AQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/istanbul-lib-coverage": {
|
||||||
|
"version": "2.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz",
|
||||||
|
"integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/@types/istanbul-lib-report": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@types/istanbul-lib-coverage": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@types/istanbul-reports": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz",
|
||||||
|
"integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@types/istanbul-lib-report": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/mkdirp": {
|
"node_modules/@types/mkdirp": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/mkdirp/-/mkdirp-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/mkdirp/-/mkdirp-1.0.1.tgz",
|
||||||
@ -47,6 +107,21 @@
|
|||||||
"integrity": "sha512-syUgf67ZQpaJj01/tRTknkMNoBBLWJOBODF0Zm4NrXmiSuxjymFrxnTu1QVYRubhVkRcZLYZG8STTwJRdVm/WQ==",
|
"integrity": "sha512-syUgf67ZQpaJj01/tRTknkMNoBBLWJOBODF0Zm4NrXmiSuxjymFrxnTu1QVYRubhVkRcZLYZG8STTwJRdVm/WQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/yargs": {
|
||||||
|
"version": "17.0.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.10.tgz",
|
||||||
|
"integrity": "sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@types/yargs-parser": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@types/yargs-parser": {
|
||||||
|
"version": "21.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz",
|
||||||
|
"integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/@ungap/promise-all-settled": {
|
"node_modules/@ungap/promise-all-settled": {
|
||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz",
|
||||||
@ -68,6 +143,20 @@
|
|||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/ansi-styles": {
|
||||||
|
"version": "4.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||||
|
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||||
|
"dependencies": {
|
||||||
|
"color-convert": "^2.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/anymatch": {
|
"node_modules/anymatch": {
|
||||||
"version": "3.1.1",
|
"version": "3.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz",
|
||||||
@ -142,6 +231,21 @@
|
|||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/chalk": {
|
||||||
|
"version": "4.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||||
|
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
|
||||||
|
"dependencies": {
|
||||||
|
"ansi-styles": "^4.1.0",
|
||||||
|
"supports-color": "^7.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/chalk/chalk?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/check-error": {
|
"node_modules/check-error": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
|
||||||
@ -183,6 +287,22 @@
|
|||||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/color-convert": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"color-name": "~1.1.4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=7.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/color-name": {
|
||||||
|
"version": "1.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||||
|
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
||||||
|
},
|
||||||
"node_modules/concat-map": {
|
"node_modules/concat-map": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||||
@ -395,6 +515,19 @@
|
|||||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||||
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA="
|
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA="
|
||||||
},
|
},
|
||||||
|
"node_modules/jest-mock": {
|
||||||
|
"version": "28.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-28.1.0.tgz",
|
||||||
|
"integrity": "sha512-H7BrhggNn77WhdL7O1apG0Q/iwl0Bdd5E1ydhCJzL3oBLh/UYxAwR3EJLsBZ9XA3ZU4PA3UNw4tQjduBTCTmLw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@jest/types": "^28.1.0",
|
||||||
|
"@types/node": "*"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/log-symbols": {
|
"node_modules/log-symbols": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz",
|
||||||
@ -406,51 +539,6 @@
|
|||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/log-symbols/node_modules/ansi-styles": {
|
|
||||||
"version": "4.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
|
||||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
|
||||||
"dependencies": {
|
|
||||||
"color-convert": "^2.0.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/log-symbols/node_modules/chalk": {
|
|
||||||
"version": "4.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz",
|
|
||||||
"integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==",
|
|
||||||
"dependencies": {
|
|
||||||
"ansi-styles": "^4.1.0",
|
|
||||||
"supports-color": "^7.1.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/chalk/chalk?sponsor=1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/log-symbols/node_modules/color-convert": {
|
|
||||||
"version": "2.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
|
||||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"color-name": "~1.1.4"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=7.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/log-symbols/node_modules/color-name": {
|
|
||||||
"version": "1.1.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
|
||||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
|
||||||
},
|
|
||||||
"node_modules/minimatch": {
|
"node_modules/minimatch": {
|
||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||||
@ -524,20 +612,6 @@
|
|||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mocha/node_modules/ansi-styles": {
|
|
||||||
"version": "4.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
|
||||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
|
||||||
"dependencies": {
|
|
||||||
"color-convert": "^2.0.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/mocha/node_modules/argparse": {
|
"node_modules/mocha/node_modules/argparse": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
||||||
@ -553,22 +627,6 @@
|
|||||||
"wrap-ansi": "^7.0.0"
|
"wrap-ansi": "^7.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mocha/node_modules/color-convert": {
|
|
||||||
"version": "2.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
|
||||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"color-name": "~1.1.4"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=7.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/mocha/node_modules/color-name": {
|
|
||||||
"version": "1.1.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
|
||||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
|
||||||
},
|
|
||||||
"node_modules/mocha/node_modules/emoji-regex": {
|
"node_modules/mocha/node_modules/emoji-regex": {
|
||||||
"version": "8.0.0",
|
"version": "8.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||||
@ -1029,12 +1087,65 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@jest/schemas": {
|
||||||
|
"version": "28.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-28.0.2.tgz",
|
||||||
|
"integrity": "sha512-YVDJZjd4izeTDkij00vHHAymNXQ6WWsdChFRK86qck6Jpr3DCL5W3Is3vslviRlP+bLuMYRLbdp98amMvqudhA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@sinclair/typebox": "^0.23.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@jest/types": {
|
||||||
|
"version": "28.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jest/types/-/types-28.1.0.tgz",
|
||||||
|
"integrity": "sha512-xmEggMPr317MIOjjDoZ4ejCSr9Lpbt/u34+dvc99t7DS8YirW5rwZEhzKPC2BMUFkUhI48qs6qLUSGw5FuL0GA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@jest/schemas": "^28.0.2",
|
||||||
|
"@types/istanbul-lib-coverage": "^2.0.0",
|
||||||
|
"@types/istanbul-reports": "^3.0.0",
|
||||||
|
"@types/node": "*",
|
||||||
|
"@types/yargs": "^17.0.8",
|
||||||
|
"chalk": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@sinclair/typebox": {
|
||||||
|
"version": "0.23.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.23.5.tgz",
|
||||||
|
"integrity": "sha512-AFBVi/iT4g20DHoujvMH1aEDn8fGJh4xsRGCP6d8RpLPMqsNPvW01Jcn0QysXTsg++/xj25NmJsGyH9xug/wKg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"@types/chai": {
|
"@types/chai": {
|
||||||
"version": "4.2.15",
|
"version": "4.2.15",
|
||||||
"resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.15.tgz",
|
"resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.15.tgz",
|
||||||
"integrity": "sha512-rYff6FI+ZTKAPkJUoyz7Udq3GaoDZnxYDEvdEdFZASiA7PoErltHezDishqQiSDWrGxvxmplH304jyzQmjp0AQ==",
|
"integrity": "sha512-rYff6FI+ZTKAPkJUoyz7Udq3GaoDZnxYDEvdEdFZASiA7PoErltHezDishqQiSDWrGxvxmplH304jyzQmjp0AQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@types/istanbul-lib-coverage": {
|
||||||
|
"version": "2.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz",
|
||||||
|
"integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"@types/istanbul-lib-report": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/istanbul-lib-coverage": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@types/istanbul-reports": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz",
|
||||||
|
"integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/istanbul-lib-report": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@types/mkdirp": {
|
"@types/mkdirp": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/mkdirp/-/mkdirp-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/mkdirp/-/mkdirp-1.0.1.tgz",
|
||||||
@ -1056,6 +1167,21 @@
|
|||||||
"integrity": "sha512-syUgf67ZQpaJj01/tRTknkMNoBBLWJOBODF0Zm4NrXmiSuxjymFrxnTu1QVYRubhVkRcZLYZG8STTwJRdVm/WQ==",
|
"integrity": "sha512-syUgf67ZQpaJj01/tRTknkMNoBBLWJOBODF0Zm4NrXmiSuxjymFrxnTu1QVYRubhVkRcZLYZG8STTwJRdVm/WQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@types/yargs": {
|
||||||
|
"version": "17.0.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.10.tgz",
|
||||||
|
"integrity": "sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/yargs-parser": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@types/yargs-parser": {
|
||||||
|
"version": "21.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz",
|
||||||
|
"integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"@ungap/promise-all-settled": {
|
"@ungap/promise-all-settled": {
|
||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz",
|
||||||
@ -1071,6 +1197,14 @@
|
|||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz",
|
||||||
"integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw=="
|
"integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw=="
|
||||||
},
|
},
|
||||||
|
"ansi-styles": {
|
||||||
|
"version": "4.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||||
|
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||||
|
"requires": {
|
||||||
|
"color-convert": "^2.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"anymatch": {
|
"anymatch": {
|
||||||
"version": "3.1.1",
|
"version": "3.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz",
|
||||||
@ -1130,6 +1264,15 @@
|
|||||||
"type-detect": "^4.0.5"
|
"type-detect": "^4.0.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"chalk": {
|
||||||
|
"version": "4.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||||
|
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
|
||||||
|
"requires": {
|
||||||
|
"ansi-styles": "^4.1.0",
|
||||||
|
"supports-color": "^7.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"check-error": {
|
"check-error": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
|
||||||
@ -1158,6 +1301,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"color-convert": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||||
|
"requires": {
|
||||||
|
"color-name": "~1.1.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"color-name": {
|
||||||
|
"version": "1.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||||
|
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
||||||
|
},
|
||||||
"concat-map": {
|
"concat-map": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||||
@ -1310,44 +1466,22 @@
|
|||||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||||
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA="
|
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA="
|
||||||
},
|
},
|
||||||
|
"jest-mock": {
|
||||||
|
"version": "28.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-28.1.0.tgz",
|
||||||
|
"integrity": "sha512-H7BrhggNn77WhdL7O1apG0Q/iwl0Bdd5E1ydhCJzL3oBLh/UYxAwR3EJLsBZ9XA3ZU4PA3UNw4tQjduBTCTmLw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@jest/types": "^28.1.0",
|
||||||
|
"@types/node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"log-symbols": {
|
"log-symbols": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz",
|
||||||
"integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==",
|
"integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"chalk": "^4.0.0"
|
"chalk": "^4.0.0"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"ansi-styles": {
|
|
||||||
"version": "4.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
|
||||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
|
||||||
"requires": {
|
|
||||||
"color-convert": "^2.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"chalk": {
|
|
||||||
"version": "4.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz",
|
|
||||||
"integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==",
|
|
||||||
"requires": {
|
|
||||||
"ansi-styles": "^4.1.0",
|
|
||||||
"supports-color": "^7.1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"color-convert": {
|
|
||||||
"version": "2.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
|
||||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
|
||||||
"requires": {
|
|
||||||
"color-name": "~1.1.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"color-name": {
|
|
||||||
"version": "1.1.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
|
||||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"minimatch": {
|
"minimatch": {
|
||||||
@ -1400,14 +1534,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||||
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="
|
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="
|
||||||
},
|
},
|
||||||
"ansi-styles": {
|
|
||||||
"version": "4.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
|
||||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
|
||||||
"requires": {
|
|
||||||
"color-convert": "^2.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"argparse": {
|
"argparse": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
||||||
@ -1423,19 +1549,6 @@
|
|||||||
"wrap-ansi": "^7.0.0"
|
"wrap-ansi": "^7.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"color-convert": {
|
|
||||||
"version": "2.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
|
||||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
|
||||||
"requires": {
|
|
||||||
"color-name": "~1.1.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"color-name": {
|
|
||||||
"version": "1.1.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
|
||||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
|
||||||
},
|
|
||||||
"emoji-regex": {
|
"emoji-regex": {
|
||||||
"version": "8.0.0",
|
"version": "8.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
"@types/chai": "^4.2.15",
|
"@types/chai": "^4.2.15",
|
||||||
"@types/mkdirp": "^1.0.1",
|
"@types/mkdirp": "^1.0.1",
|
||||||
"@types/mocha": "^8.2.1",
|
"@types/mocha": "^8.2.1",
|
||||||
|
"jest-mock": "^28.0.2",
|
||||||
"typescript": "^4.5.5"
|
"typescript": "^4.5.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { mocked } from 'ts-jest/utils';
|
import { mocked } from 'jest-mock';
|
||||||
|
|
||||||
import { SendRequestCallback } from './insomnia';
|
import { SendRequestCallback } from './insomnia';
|
||||||
import { runTests } from './run';
|
import { runTests } from './run';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { mocked } from 'ts-jest/utils';
|
import { mocked } from 'jest-mock';
|
||||||
|
|
||||||
import { SendRequestCallback } from '../run/insomnia';
|
import { SendRequestCallback } from '../run/insomnia';
|
||||||
|
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
/** @type { import('@jest/types').Config.InitialOptions } */
|
/** @type { import('@jest/types').Config.InitialOptions } */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
preset: '../../jest-preset.js',
|
preset: '../../jest-preset.js',
|
||||||
|
globals: {
|
||||||
|
'ts-jest': {
|
||||||
|
isolatedModules: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
/** @type { import('@jest/types').Config.InitialOptions } */
|
/** @type { import('@jest/types').Config.InitialOptions } */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
preset: '../../jest-preset.js',
|
preset: '../../jest-preset.js',
|
||||||
|
globals: {
|
||||||
|
'ts-jest': {
|
||||||
|
isolatedModules: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
/** @type { import('@babel/core').TransformOptions } */
|
|
||||||
module.exports = {
|
|
||||||
presets: [
|
|
||||||
['@babel/preset-env',{targets: {electron: '18.1.0'}}],
|
|
||||||
'@babel/preset-typescript',
|
|
||||||
'@babel/preset-react',
|
|
||||||
],
|
|
||||||
plugins: [
|
|
||||||
["@babel/plugin-proposal-nullish-coalescing-operator"],
|
|
||||||
['@babel/plugin-proposal-decorators', { legacy: true }],
|
|
||||||
['@babel/plugin-proposal-class-properties', { loose: true }],
|
|
||||||
['@babel/plugin-proposal-private-property-in-object', { loose: true }],
|
|
||||||
['@babel/plugin-proposal-private-methods', { loose: true }]
|
|
||||||
],
|
|
||||||
}
|
|
@ -1,29 +1,20 @@
|
|||||||
/** @type { import('@jest/types').Config.InitialOptions } */
|
/** @type { import('@jest/types').Config.InitialOptions } */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// preset: '../../jest-preset.js', // DOES NOT WORK
|
preset: '../../jest-preset.js',
|
||||||
// same as preset:
|
|
||||||
collectCoverage: false,
|
|
||||||
globals: {
|
globals: {
|
||||||
'ts-jest': {
|
'ts-jest': {
|
||||||
isolatedModules: true,
|
isolatedModules: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
|
||||||
resetMocks: true,
|
|
||||||
resetModules: true,
|
|
||||||
testRegex: ['.+\\.test\\.tsx?$'],
|
|
||||||
transform: { '^.+\\.tsx?$': 'ts-jest' },
|
|
||||||
|
|
||||||
// extended from preset:
|
|
||||||
cache: false,
|
cache: false,
|
||||||
modulePathIgnorePatterns: ['<rootDir>/network/.*/__mocks__'],
|
modulePathIgnorePatterns: ['./src/network/.*/__mocks__'],
|
||||||
rootDir: 'src',
|
setupFiles: ['./src/__jest__/setup.ts'],
|
||||||
setupFiles: ['./__jest__/setup.ts'],
|
setupFilesAfterEnv: ['./src/__jest__/setup-after-env.ts'],
|
||||||
setupFilesAfterEnv: ['./__jest__/setup-after-env.ts'],
|
|
||||||
testEnvironment: 'jsdom',
|
testEnvironment: 'jsdom',
|
||||||
verbose: true,
|
verbose: true,
|
||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
'\\.(css|less|png)$': '<rootDir>/__mocks__/dummy.ts',
|
'\\.(css|less|png)$': '<rootDir>/src/__mocks__/dummy.ts',
|
||||||
'styled-components': '<rootDir>/../node_modules/styled-components',
|
'styled-components': '<rootDir>/node_modules/styled-components',
|
||||||
|
'jsonpath-plus': '<rootDir>/node_modules/jsonpath-plus/dist/index-node-cjs.cjs',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
11498
packages/insomnia/package-lock.json
generated
11498
packages/insomnia/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,7 @@
|
|||||||
"build": "npm run build:sr && npm run build:app",
|
"build": "npm run build:sr && npm run build:app",
|
||||||
"build:app": "esr --cache ./scripts/build.ts --noErrorTruncation",
|
"build:app": "esr --cache ./scripts/build.ts --noErrorTruncation",
|
||||||
"build:main.min.js": "cross-env NODE_ENV=development esr esbuild.main.ts",
|
"build:main.min.js": "cross-env NODE_ENV=development esr esbuild.main.ts",
|
||||||
"build:sr": " esr esbuild.sr.ts",
|
"build:sr": "esr esbuild.sr.ts",
|
||||||
"bump-version": "esr scripts/bumpVersion.ts",
|
"bump-version": "esr scripts/bumpVersion.ts",
|
||||||
"clean": "tsc --build tsconfig.build.json --clean",
|
"clean": "tsc --build tsconfig.build.json --clean",
|
||||||
"postclean": "rimraf build dist src/main.min.js",
|
"postclean": "rimraf build dist src/main.min.js",
|
||||||
@ -109,10 +109,11 @@
|
|||||||
"@babel/preset-react": "^7.14.5",
|
"@babel/preset-react": "^7.14.5",
|
||||||
"@babel/preset-typescript": "^7.15.0",
|
"@babel/preset-typescript": "^7.15.0",
|
||||||
"@develohpanda/fluent-builder": "^2.1.2",
|
"@develohpanda/fluent-builder": "^2.1.2",
|
||||||
"@testing-library/jest-dom": "^5.11.5",
|
"@testing-library/dom": "^8.13.0",
|
||||||
"@testing-library/react": "^11.2.6",
|
"@testing-library/jest-dom": "^5.16.4",
|
||||||
"@testing-library/react-hooks": "^5.1.2",
|
"@testing-library/react": "^12.1.5",
|
||||||
"@testing-library/user-event": "^14.0.0-beta.7",
|
"@testing-library/react-hooks": "^8.0.0",
|
||||||
|
"@testing-library/user-event": "^14.2.0",
|
||||||
"@types/analytics-node": "^3.1.7",
|
"@types/analytics-node": "^3.1.7",
|
||||||
"@types/aws4": "^1.11.1",
|
"@types/aws4": "^1.11.1",
|
||||||
"@types/clone": "^2.1.0",
|
"@types/clone": "^2.1.0",
|
||||||
@ -140,13 +141,12 @@
|
|||||||
"@types/redux-mock-store": "^1.0.2",
|
"@types/redux-mock-store": "^1.0.2",
|
||||||
"@types/styled-components": "^5.1.23",
|
"@types/styled-components": "^5.1.23",
|
||||||
"@types/swagger-ui-react": "^4.1.1",
|
"@types/swagger-ui-react": "^4.1.1",
|
||||||
"@types/testing-library__jest-dom": "^5.9.5",
|
|
||||||
"@types/testing-library__react-hooks": "^4.0.0",
|
|
||||||
"@types/tough-cookie": "^2.3.7",
|
"@types/tough-cookie": "^2.3.7",
|
||||||
"@types/uuid": "^8.3.4",
|
"@types/uuid": "^8.3.4",
|
||||||
"@types/vkbeautify": "^0.99.2",
|
"@types/vkbeautify": "^0.99.2",
|
||||||
"@types/yaml": "^1.9.7",
|
"@types/yaml": "^1.9.7",
|
||||||
"@vitejs/plugin-react": "^1.2.0",
|
"@vitejs/plugin-react": "^1.2.0",
|
||||||
|
"buffer": "^6.0.3",
|
||||||
"class-autobind-decorator": "^3.0.1",
|
"class-autobind-decorator": "^3.0.1",
|
||||||
"classnames": "^2.3.1",
|
"classnames": "^2.3.1",
|
||||||
"codemirror": "^5.65.2",
|
"codemirror": "^5.65.2",
|
||||||
@ -168,7 +168,9 @@
|
|||||||
"graphql-language-service": "^4.1.5",
|
"graphql-language-service": "^4.1.5",
|
||||||
"highlight.js": "^11.5.1",
|
"highlight.js": "^11.5.1",
|
||||||
"insomnia-components": "3.1.0-beta.1",
|
"insomnia-components": "3.1.0-beta.1",
|
||||||
"jest": "^26.6.3",
|
"jest": "^28.1.0",
|
||||||
|
"jest-environment-jsdom": "^28.0.2",
|
||||||
|
"jest-mock": "^28.0.2",
|
||||||
"json-order": "^1.1.0",
|
"json-order": "^1.1.0",
|
||||||
"jwt-authentication": "^0.4.0",
|
"jwt-authentication": "^0.4.0",
|
||||||
"less": "^3.8.1",
|
"less": "^3.8.1",
|
||||||
|
@ -5,6 +5,7 @@ import * as models from '../models';
|
|||||||
export async function globalBeforeEach() {
|
export async function globalBeforeEach() {
|
||||||
// Setup the local database in case it's used
|
// Setup the local database in case it's used
|
||||||
fetch.setup('insomnia-tests', 'http://localhost:8000');
|
fetch.setup('insomnia-tests', 'http://localhost:8000');
|
||||||
|
|
||||||
await db.init(
|
await db.init(
|
||||||
models.types(),
|
models.types(),
|
||||||
{
|
{
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import buffer from 'buffer/';
|
||||||
|
|
||||||
import * as crypt from '../crypt';
|
import * as crypt from '../crypt';
|
||||||
|
|
||||||
describe('crypt', () => {
|
describe('crypt', () => {
|
||||||
@ -33,9 +35,10 @@ describe('crypt', () => {
|
|||||||
key_ops: ['encrypt', 'decrypt'],
|
key_ops: ['encrypt', 'decrypt'],
|
||||||
k: '5hs1f2xuiNPHUp11i6SWlsqYpWe_hWPcEKucZlwBfFE',
|
k: '5hs1f2xuiNPHUp11i6SWlsqYpWe_hWPcEKucZlwBfFE',
|
||||||
};
|
};
|
||||||
const resultEncrypted = crypt.encryptAESBuffer(key, Buffer.from('Hello World!', 'utf8'));
|
const source = buffer.Buffer.from('Hello World!', 'utf8');
|
||||||
|
const resultEncrypted = crypt.encryptAESBuffer(key, source);
|
||||||
const resultDecrypted = crypt.decryptAESToBuffer(key, resultEncrypted);
|
const resultDecrypted = crypt.decryptAESToBuffer(key, resultEncrypted);
|
||||||
expect(resultDecrypted).toEqual(Buffer.from('Hello World!', 'utf8'));
|
expect(resultDecrypted.toString()).toEqual(source.toString());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,16 +1,12 @@
|
|||||||
|
import { jest } from '@jest/globals';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
import { globalBeforeEach } from '../../__jest__/before-each';
|
import { globalBeforeEach } from '../../__jest__/before-each';
|
||||||
import LocalStorage from '../../main/local-storage';
|
import LocalStorage from '../../main/local-storage';
|
||||||
|
|
||||||
jest.spyOn(global, 'setTimeout');
|
|
||||||
|
|
||||||
describe('LocalStorage()', () => {
|
describe('LocalStorage()', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(globalBeforeEach);
|
||||||
await globalBeforeEach();
|
|
||||||
jest.useFakeTimers();
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
jest.clearAllTimers();
|
jest.clearAllTimers();
|
||||||
@ -74,8 +70,6 @@ describe('LocalStorage()', () => {
|
|||||||
fs.rmdirSync(basePath);
|
fs.rmdirSync(basePath);
|
||||||
localStorage.setItem('key', 'value');
|
localStorage.setItem('key', 'value');
|
||||||
|
|
||||||
jest.runAllTimers();
|
|
||||||
|
|
||||||
// Since the above operation failed to write, we should now get back
|
// Since the above operation failed to write, we should now get back
|
||||||
// the default value
|
// the default value
|
||||||
expect(localStorage.getItem('key', 'different')).toBe('different');
|
expect(localStorage.getItem('key', 'different')).toBe('different');
|
||||||
@ -83,16 +77,13 @@ describe('LocalStorage()', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('stores a key', () => {
|
it('stores a key', () => {
|
||||||
|
jest.useFakeTimers();
|
||||||
const basePath = `/tmp/insomnia-localstorage-${Math.random()}`;
|
const basePath = `/tmp/insomnia-localstorage-${Math.random()}`;
|
||||||
const localStorage = new LocalStorage(basePath);
|
const localStorage = new LocalStorage(basePath);
|
||||||
localStorage.setItem('foo', 'bar');
|
localStorage.setItem('foo', 'bar');
|
||||||
|
|
||||||
// Assert timeouts are called
|
|
||||||
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
||||||
expect(setTimeout).toHaveBeenCalledWith(expect.anything(), 100);
|
|
||||||
|
|
||||||
// Force debouncer to flush
|
// Force debouncer to flush
|
||||||
jest.runAllTimers();
|
jest.runOnlyPendingTimers();
|
||||||
|
|
||||||
// Assert there is one item stored
|
// Assert there is one item stored
|
||||||
expect(fs.readdirSync(basePath).length).toEqual(1);
|
expect(fs.readdirSync(basePath).length).toEqual(1);
|
||||||
@ -103,21 +94,16 @@ describe('LocalStorage()', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('debounces key sets', () => {
|
it('debounces key sets', () => {
|
||||||
|
jest.useFakeTimers();
|
||||||
const basePath = `/tmp/insomnia-localstorage-${Math.random()}`;
|
const basePath = `/tmp/insomnia-localstorage-${Math.random()}`;
|
||||||
const localStorage = new LocalStorage(basePath);
|
const localStorage = new LocalStorage(basePath);
|
||||||
localStorage.setItem('foo', 'bar1');
|
localStorage.setItem('foo', 'bar1');
|
||||||
localStorage.setItem('another', 10);
|
localStorage.setItem('another', 10);
|
||||||
localStorage.setItem('foo', 'bar3');
|
localStorage.setItem('foo', 'bar3');
|
||||||
|
|
||||||
// Assert timeouts are called
|
|
||||||
expect(setTimeout).toHaveBeenCalledTimes(3);
|
|
||||||
expect(setTimeout).nthCalledWith(1, expect.anything(), 100);
|
|
||||||
expect(setTimeout).nthCalledWith(2, expect.anything(), 100);
|
|
||||||
expect(setTimeout).nthCalledWith(3, expect.anything(), 100);
|
|
||||||
expect(fs.readdirSync(basePath).length).toEqual(0);
|
expect(fs.readdirSync(basePath).length).toEqual(0);
|
||||||
|
|
||||||
// Force flush
|
// Force debouncer to flush
|
||||||
jest.runAllTimers();
|
jest.runOnlyPendingTimers();
|
||||||
|
|
||||||
// Make sure only one item exists
|
// Make sure only one item exists
|
||||||
expect(fs.readdirSync(basePath).length).toEqual(2);
|
expect(fs.readdirSync(basePath).length).toEqual(2);
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { jest } from '@jest/globals';
|
||||||
|
|
||||||
import { globalBeforeEach } from '../../__jest__/before-each';
|
import { globalBeforeEach } from '../../__jest__/before-each';
|
||||||
import {
|
import {
|
||||||
capitalize,
|
capitalize,
|
||||||
@ -19,8 +21,6 @@ import {
|
|||||||
xmlDecode,
|
xmlDecode,
|
||||||
} from '../misc';
|
} from '../misc';
|
||||||
|
|
||||||
jest.spyOn(global, 'setTimeout');
|
|
||||||
|
|
||||||
describe('hasAuthHeader()', () => {
|
describe('hasAuthHeader()', () => {
|
||||||
beforeEach(globalBeforeEach);
|
beforeEach(globalBeforeEach);
|
||||||
|
|
||||||
@ -142,22 +142,25 @@ describe('filterHeaders()', () => {
|
|||||||
describe('keyedDebounce()', () => {
|
describe('keyedDebounce()', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await globalBeforeEach();
|
await globalBeforeEach();
|
||||||
jest.useFakeTimers();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('debounces correctly', () => {
|
it('debounces correctly', async () => {
|
||||||
const resultsList = [];
|
jest.useFakeTimers();
|
||||||
const fn = keyedDebounce(results => {
|
const resultsList: Record<string, string[]>[] = [];
|
||||||
resultsList.push(results);
|
const setter = jest.fn((result: Record<string, string[]>) => {
|
||||||
}, 100);
|
resultsList.push(result);
|
||||||
|
});
|
||||||
|
jest.clearAllTimers();
|
||||||
|
const fn = keyedDebounce<string>(setter, 100);
|
||||||
fn('foo', 'bar');
|
fn('foo', 'bar');
|
||||||
fn('baz', 'bar');
|
fn('baz', 'bar');
|
||||||
fn('foo', 'bar2');
|
fn('foo', 'bar2');
|
||||||
fn('foo', 'bar3');
|
fn('foo', 'bar3');
|
||||||
fn('multi', 'foo', 'bar', 'baz');
|
fn('multi', 'foo', 'bar', 'baz');
|
||||||
expect(setTimeout).toHaveBeenCalledTimes(5);
|
|
||||||
expect(resultsList).toEqual([]);
|
expect(resultsList).toEqual([]);
|
||||||
|
|
||||||
jest.runAllTimers();
|
jest.runAllTimers();
|
||||||
|
|
||||||
expect(resultsList).toEqual([
|
expect(resultsList).toEqual([
|
||||||
{
|
{
|
||||||
foo: ['bar3'],
|
foo: ['bar3'],
|
||||||
@ -169,12 +172,10 @@ describe('keyedDebounce()', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('debounce()', () => {
|
describe('debounce()', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(globalBeforeEach);
|
||||||
await globalBeforeEach();
|
|
||||||
jest.useFakeTimers();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('debounces correctly', () => {
|
it('debounces correctly', () => {
|
||||||
|
jest.useFakeTimers();
|
||||||
const resultList = [];
|
const resultList = [];
|
||||||
const fn = debounce((...args) => {
|
const fn = debounce((...args) => {
|
||||||
resultList.push(args);
|
resultList.push(args);
|
||||||
@ -184,9 +185,8 @@ describe('debounce()', () => {
|
|||||||
fn('multi', 'foo', 'bar', 'baz');
|
fn('multi', 'foo', 'bar', 'baz');
|
||||||
fn('baz', 'bar');
|
fn('baz', 'bar');
|
||||||
fn('foo', 'bar3');
|
fn('foo', 'bar3');
|
||||||
expect(setTimeout).toHaveBeenCalledTimes(5);
|
|
||||||
expect(resultList).toEqual([]);
|
expect(resultList).toEqual([]);
|
||||||
jest.runAllTimers();
|
jest.runOnlyPendingTimers();
|
||||||
expect(resultList).toEqual([['foo', 'bar3']]);
|
expect(resultList).toEqual([['foo', 'bar3']]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { mocked } from 'ts-jest/utils';
|
import { mocked } from 'jest-mock';
|
||||||
|
|
||||||
import { ConfigError, getConfigSettings as _getConfigSettings } from '../../models/helpers/settings';
|
import { ConfigError, getConfigSettings as _getConfigSettings } from '../../models/helpers/settings';
|
||||||
import { validateInsomniaConfig } from '../validate-insomnia-config';
|
import { validateInsomniaConfig } from '../validate-insomnia-config';
|
||||||
|
@ -276,12 +276,6 @@ export const database = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
flushChangesAsync: async (fake = false) => {
|
|
||||||
process.nextTick(async () => {
|
|
||||||
await database.flushChanges(0, fake);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
get: async function<T extends BaseModel>(type: string, id?: string) {
|
get: async function<T extends BaseModel>(type: string, id?: string) {
|
||||||
if (db._empty) {
|
if (db._empty) {
|
||||||
return _send<T>('get', ...arguments);
|
return _send<T>('get', ...arguments);
|
||||||
@ -348,7 +342,9 @@ export const database = {
|
|||||||
config,
|
config,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
collection.persistence.setAutocompactionInterval(DB_PERSIST_INTERVAL);
|
if (!config.inMemoryOnly) {
|
||||||
|
collection.persistence.setAutocompactionInterval(DB_PERSIST_INTERVAL);
|
||||||
|
}
|
||||||
db[modelType] = collection;
|
db[modelType] = collection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,18 +132,21 @@ export function formatMethodName(method: string) {
|
|||||||
return methodName;
|
return methodName;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function keyedDebounce<T extends Function>(callback: T, millis: number = DEBOUNCE_MILLIS): T {
|
export function keyedDebounce<T>(
|
||||||
let timeout;
|
callback: (t: Record<string, T[]>) => void,
|
||||||
let results = {};
|
millis: number = DEBOUNCE_MILLIS
|
||||||
// @ts-expect-error -- TSCONVERSION
|
) {
|
||||||
const t: T = function(key, ...args) {
|
let timeout: NodeJS.Timeout;
|
||||||
|
let results: Record<string, T[]> = {};
|
||||||
|
const t = function(key: string, ...args: T[]) {
|
||||||
results[key] = args;
|
results[key] = args;
|
||||||
clearTimeout(timeout);
|
if (timeout) {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
}
|
||||||
timeout = setTimeout(() => {
|
timeout = setTimeout(() => {
|
||||||
if (!Object.keys(results).length) {
|
if (!Object.keys(results).length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(results);
|
callback(results);
|
||||||
results = {};
|
results = {};
|
||||||
}, millis);
|
}, millis);
|
||||||
|
@ -14,13 +14,13 @@ class LocalStorage {
|
|||||||
console.log(`[localstorage] Initialized at ${basePath}`);
|
console.log(`[localstorage] Initialized at ${basePath}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
setItem(key, obj) {
|
setItem<T>(key: string, obj?: T) {
|
||||||
clearTimeout(this._timeouts[key]);
|
clearTimeout(this._timeouts[key]);
|
||||||
this._buffer[key] = JSON.stringify(obj);
|
this._buffer[key] = JSON.stringify(obj);
|
||||||
this._timeouts[key] = setTimeout(this._flush.bind(this), 100);
|
this._timeouts[key] = setTimeout(this._flush.bind(this), 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
getItem(key, defaultObj) {
|
getItem<T>(key: string, defaultObj?: T) {
|
||||||
// Make sure things are flushed before we read
|
// Make sure things are flushed before we read
|
||||||
this._flush();
|
this._flush();
|
||||||
|
|
||||||
|
@ -7,87 +7,7 @@ import { getDataDirectory } from '../../common/electron-helpers';
|
|||||||
import * as models from '../../models';
|
import * as models from '../../models';
|
||||||
|
|
||||||
describe('migrate()', () => {
|
describe('migrate()', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(globalBeforeEach);
|
||||||
await globalBeforeEach();
|
|
||||||
Date.now = jest.fn(() => 1234567890);
|
|
||||||
jest.useFakeTimers();
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(async () => {
|
|
||||||
// Reset to real timers so that other test suites don't fail.
|
|
||||||
jest.useRealTimers();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('migrates utf8 body correctly', async () => {
|
|
||||||
const initialModel = {
|
|
||||||
body: 'hello world!',
|
|
||||||
encoding: 'utf8',
|
|
||||||
};
|
|
||||||
const newModel = await models.initModel(models.response.type, initialModel);
|
|
||||||
const expectedBodyPath = path.join(
|
|
||||||
getDataDirectory(),
|
|
||||||
'responses/fc3ff98e8c6a0d3087d515c0473f8677.zip',
|
|
||||||
);
|
|
||||||
const storedBody = models.response.getBodyBuffer(newModel);
|
|
||||||
// Should have set bodyPath and stored the body
|
|
||||||
expect(newModel.bodyPath).toBe(expectedBodyPath);
|
|
||||||
expect(storedBody.toString()).toBe('hello world!');
|
|
||||||
// Should have stripped these
|
|
||||||
expect(newModel.body).toBeUndefined();
|
|
||||||
expect(newModel.encoding).toBeUndefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('migrates base64 body correctly', async () => {
|
|
||||||
const initialModel = {
|
|
||||||
body: 'aGVsbG8gd29ybGQh',
|
|
||||||
encoding: 'base64',
|
|
||||||
};
|
|
||||||
const newModel = await models.initModel(models.response.type, initialModel);
|
|
||||||
jest.runAllTimers();
|
|
||||||
const expectedBodyPath = path.join(
|
|
||||||
getDataDirectory(),
|
|
||||||
'responses/fc3ff98e8c6a0d3087d515c0473f8677.zip',
|
|
||||||
);
|
|
||||||
const storedBody = models.response.getBodyBuffer(newModel);
|
|
||||||
// Should have stripped these
|
|
||||||
expect(newModel.body).toBeUndefined();
|
|
||||||
expect(newModel.encoding).toBeUndefined();
|
|
||||||
// Should have set bodyPath and stored the body
|
|
||||||
expect(newModel.bodyPath).toBe(expectedBodyPath);
|
|
||||||
expect(storedBody.toString()).toBe('hello world!');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('migrates empty body', async () => {
|
|
||||||
const initialModel = {
|
|
||||||
body: '',
|
|
||||||
};
|
|
||||||
const newModel = await models.initModel(models.response.type, initialModel);
|
|
||||||
jest.runAllTimers();
|
|
||||||
jest.runAllTimers();
|
|
||||||
const expectedBodyPath = path.join(
|
|
||||||
getDataDirectory(),
|
|
||||||
'responses/d41d8cd98f00b204e9800998ecf8427e.zip',
|
|
||||||
);
|
|
||||||
const storedBody = models.response.getBodyBuffer(newModel);
|
|
||||||
// Should have stripped these
|
|
||||||
expect(newModel.body).toBeUndefined();
|
|
||||||
expect(newModel.encoding).toBeUndefined();
|
|
||||||
// Should have set bodyPath and stored the body
|
|
||||||
expect(newModel.bodyPath).toBe(expectedBodyPath);
|
|
||||||
expect(storedBody.toString()).toBe('');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('does not migrate body again', async () => {
|
|
||||||
const initialModel = {
|
|
||||||
bodyPath: '/foo/bar',
|
|
||||||
};
|
|
||||||
const newModel = await models.initModel(models.response.type, initialModel);
|
|
||||||
// Should have stripped these
|
|
||||||
expect(newModel.body).toBeUndefined();
|
|
||||||
expect(newModel.encoding).toBeUndefined();
|
|
||||||
// Should have set bodyPath and stored the body
|
|
||||||
expect(newModel.bodyPath).toBe('/foo/bar');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('does it', async () => {
|
it('does it', async () => {
|
||||||
const bodyPath = path.join(getDataDirectory(), 'foo.zip');
|
const bodyPath = path.join(getDataDirectory(), 'foo.zip');
|
||||||
@ -100,16 +20,6 @@ describe('migrate()', () => {
|
|||||||
expect(body).toBe('Hello World!');
|
expect(body).toBe('Hello World!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('migrates old bodies', async () => {
|
|
||||||
const response = await models.initModel(models.response.type, {
|
|
||||||
body: 'aGVsbG8gd29ybGQh',
|
|
||||||
encoding: 'base64',
|
|
||||||
});
|
|
||||||
const body = await models.response.getBodyBuffer(response).toString();
|
|
||||||
expect(response.bodyCompression).toBe(null);
|
|
||||||
expect(body).toBe('hello world!');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('migrates leaves bodyCompression for null', async () => {
|
it('migrates leaves bodyCompression for null', async () => {
|
||||||
expect(
|
expect(
|
||||||
(
|
(
|
||||||
@ -142,84 +52,3 @@ describe('migrate()', () => {
|
|||||||
).toBe('zip');
|
).toBe('zip');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('cleanDeletedResponses()', function() {
|
|
||||||
beforeEach(globalBeforeEach);
|
|
||||||
afterEach(function() {
|
|
||||||
jest.restoreAllMocks();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('deletes nothing if there is no files in directory', async function() {
|
|
||||||
const mockReaddirSync = jest.spyOn(fs, 'readdirSync');
|
|
||||||
const mockUnlinkSync = jest.spyOn(fs, 'unlinkSync');
|
|
||||||
mockReaddirSync.mockReturnValueOnce([]);
|
|
||||||
mockUnlinkSync.mockImplementation();
|
|
||||||
await models.response.cleanDeletedResponses();
|
|
||||||
expect(fs.unlinkSync.mock.calls.length).toBe(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('only deletes response files that are not in db', async function() {
|
|
||||||
const responsesDir = path.join(getDataDirectory(), 'responses');
|
|
||||||
const dbResponseIds = await createModels(responsesDir, 10);
|
|
||||||
const notDbResponseIds = [];
|
|
||||||
|
|
||||||
for (let index = 100; index < 110; index++) {
|
|
||||||
notDbResponseIds.push('res_' + index);
|
|
||||||
}
|
|
||||||
|
|
||||||
const mockReaddirSync = jest.spyOn(fs, 'readdirSync');
|
|
||||||
const mockUnlinkSync = jest.spyOn(fs, 'unlinkSync');
|
|
||||||
mockReaddirSync.mockReturnValueOnce([...dbResponseIds, ...notDbResponseIds]);
|
|
||||||
mockUnlinkSync.mockImplementation();
|
|
||||||
await models.response.cleanDeletedResponses();
|
|
||||||
expect(fs.unlinkSync.mock.calls.length).toBe(notDbResponseIds.length);
|
|
||||||
Object.keys(notDbResponseIds).map(index => {
|
|
||||||
const resId = notDbResponseIds[index];
|
|
||||||
const bodyPath = path.join(responsesDir, resId);
|
|
||||||
expect(fs.unlinkSync.mock.calls[index][0]).toBe(bodyPath);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create mock workspaces, requests, and responses as many as {@code count}.
|
|
||||||
* @param responsesDir
|
|
||||||
* @param count
|
|
||||||
* @returns {Promise<string[]>} the created response ids
|
|
||||||
*/
|
|
||||||
async function createModels(responsesDir, count) {
|
|
||||||
if (count < 1) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
const responseIds = [];
|
|
||||||
|
|
||||||
for (let index = 0; index < count; index++) {
|
|
||||||
const workspaceId = 'wrk_' + index;
|
|
||||||
const requestId = 'req_' + index;
|
|
||||||
const responseId = 'res_' + index;
|
|
||||||
await models.workspace.create({
|
|
||||||
_id: workspaceId,
|
|
||||||
created: 111,
|
|
||||||
modified: 222,
|
|
||||||
});
|
|
||||||
await models.request.create({
|
|
||||||
_id: requestId,
|
|
||||||
parentId: workspaceId,
|
|
||||||
created: 111,
|
|
||||||
modified: 222,
|
|
||||||
metaSortKey: 0,
|
|
||||||
url: 'https://insomnia.rest',
|
|
||||||
});
|
|
||||||
await models.response.create({
|
|
||||||
_id: responseId,
|
|
||||||
parentId: requestId,
|
|
||||||
statusCode: 200,
|
|
||||||
body: 'foo',
|
|
||||||
bodyPath: path.join(responsesDir, responseId),
|
|
||||||
});
|
|
||||||
responseIds.push(responseId);
|
|
||||||
}
|
|
||||||
|
|
||||||
return responseIds;
|
|
||||||
}
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Settings } from 'insomnia-common';
|
import { Settings } from 'insomnia-common';
|
||||||
|
import { mocked } from 'jest-mock';
|
||||||
import { identity } from 'ramda';
|
import { identity } from 'ramda';
|
||||||
import { mocked } from 'ts-jest/utils';
|
|
||||||
|
|
||||||
import * as _constants from '../../../common/constants';
|
import * as _constants from '../../../common/constants';
|
||||||
import * as electronHelpers from '../../../common/electron-helpers';
|
import * as electronHelpers from '../../../common/electron-helpers';
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
import crypto from 'crypto';
|
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import mkdirp from 'mkdirp';
|
|
||||||
import path from 'path';
|
|
||||||
import { Readable } from 'stream';
|
import { Readable } from 'stream';
|
||||||
import { ValueOf } from 'type-fest';
|
import { ValueOf } from 'type-fest';
|
||||||
import zlib from 'zlib';
|
import zlib from 'zlib';
|
||||||
|
|
||||||
import { database as db, Query } from '../common/database';
|
import { database as db, Query } from '../common/database';
|
||||||
import { getDataDirectory } from '../common/electron-helpers';
|
|
||||||
import { LIBCURL_DEBUG_MIGRATION_MAP } from '../common/misc';
|
import { LIBCURL_DEBUG_MIGRATION_MAP } from '../common/misc';
|
||||||
import type { BaseModel } from './index';
|
import type { BaseModel } from './index';
|
||||||
import * as models from './index';
|
import * as models from './index';
|
||||||
@ -94,17 +90,12 @@ export function init(): BaseResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function migrate(doc: Response) {
|
export async function migrate(doc: Response) {
|
||||||
doc = await migrateBodyToFileSystem(doc);
|
|
||||||
doc = await migrateBodyCompression(doc);
|
doc = await migrateBodyCompression(doc);
|
||||||
doc = await migrateTimelineToFileSystem(doc);
|
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function hookDatabaseInit(consoleLog: typeof console.log = console.log) {
|
export function hookDatabaseInit(consoleLog: typeof console.log = console.log) {
|
||||||
consoleLog('[db] Init responses DB');
|
consoleLog('[db] Init responses DB');
|
||||||
process.nextTick(async () => {
|
|
||||||
await models.response.cleanDeletedResponses();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function hookRemove(doc: Response, consoleLog: typeof console.log = console.log) {
|
export function hookRemove(doc: Response, consoleLog: typeof console.log = console.log) {
|
||||||
@ -306,34 +297,6 @@ function getBodyBufferFromPath<T>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function migrateBodyToFileSystem(doc: Response) {
|
|
||||||
if (doc.hasOwnProperty('body') && doc._id && !doc.bodyPath) {
|
|
||||||
// @ts-expect-error -- TSCONVERSION previously doc.body and doc.encoding did exist but are now removed, and if they exist we want to migrate away from them
|
|
||||||
const bodyBuffer = Buffer.from(doc.body, doc.encoding || 'utf8');
|
|
||||||
const dir = path.join(getDataDirectory(), 'responses');
|
|
||||||
mkdirp.sync(dir);
|
|
||||||
const hash = crypto
|
|
||||||
.createHash('md5')
|
|
||||||
.update(bodyBuffer || '')
|
|
||||||
.digest('hex');
|
|
||||||
const bodyPath = path.join(dir, `${hash}.zip`);
|
|
||||||
|
|
||||||
try {
|
|
||||||
const buff = bodyBuffer || Buffer.from('');
|
|
||||||
fs.writeFileSync(bodyPath, buff);
|
|
||||||
} catch (err) {
|
|
||||||
console.warn('Failed to write response body to file', err.message);
|
|
||||||
}
|
|
||||||
|
|
||||||
return db.docUpdate(doc, {
|
|
||||||
bodyPath,
|
|
||||||
bodyCompression: null,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
return doc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function migrateBodyCompression(doc: Response) {
|
function migrateBodyCompression(doc: Response) {
|
||||||
if (doc.bodyCompression === '__NEEDS_MIGRATION__') {
|
if (doc.bodyCompression === '__NEEDS_MIGRATION__') {
|
||||||
doc.bodyCompression = 'zip';
|
doc.bodyCompression = 'zip';
|
||||||
@ -341,54 +304,3 @@ function migrateBodyCompression(doc: Response) {
|
|||||||
|
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function migrateTimelineToFileSystem(doc: Response) {
|
|
||||||
if (doc.hasOwnProperty('timeline') && doc._id && !doc.timelinePath) {
|
|
||||||
const dir = path.join(getDataDirectory(), 'responses');
|
|
||||||
mkdirp.sync(dir);
|
|
||||||
// @ts-expect-error -- TSCONVERSION previously doc.timeline did exist but is now removed, and if it exists we want to migrate away from it
|
|
||||||
const timelineStr = JSON.stringify(doc.timeline, null, '\t');
|
|
||||||
const fsPath = doc.bodyPath + '.timeline';
|
|
||||||
|
|
||||||
try {
|
|
||||||
fs.writeFileSync(fsPath, timelineStr);
|
|
||||||
} catch (err) {
|
|
||||||
console.warn('Failed to write response body to file', err.message);
|
|
||||||
}
|
|
||||||
|
|
||||||
return db.docUpdate(doc, {
|
|
||||||
timelinePath: fsPath,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
return doc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function cleanDeletedResponses() {
|
|
||||||
const responsesDir = path.join(getDataDirectory(), 'responses');
|
|
||||||
mkdirp.sync(responsesDir);
|
|
||||||
const files = fs.readdirSync(responsesDir);
|
|
||||||
|
|
||||||
if (files.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const whitelistFiles: string[] = [];
|
|
||||||
|
|
||||||
for (const r of (await db.all<Response>(type) || [])) {
|
|
||||||
whitelistFiles.push(r.bodyPath.slice(responsesDir.length + 1));
|
|
||||||
whitelistFiles.push(r.timelinePath.slice(responsesDir.length + 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const filePath of files) {
|
|
||||||
if (whitelistFiles.indexOf(filePath) >= 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
fs.unlinkSync(path.join(responsesDir, filePath));
|
|
||||||
} catch (err) {
|
|
||||||
// Just keep going, doesn't matter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { mocked } from 'ts-jest/utils';
|
import { mocked } from 'jest-mock';
|
||||||
|
|
||||||
import { globalBeforeEach } from '../../../__jest__/before-each';
|
import { globalBeforeEach } from '../../../__jest__/before-each';
|
||||||
import {
|
import {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { mocked } from 'ts-jest/utils';
|
import { mocked } from 'jest-mock';
|
||||||
|
|
||||||
import { globalBeforeEach } from '../../../__jest__/before-each';
|
import { globalBeforeEach } from '../../../__jest__/before-each';
|
||||||
import * as models from '../../../models';
|
import * as models from '../../../models';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import electron from 'electron';
|
import electron from 'electron';
|
||||||
import { mocked } from 'ts-jest/utils';
|
import { mocked } from 'jest-mock';
|
||||||
|
|
||||||
import appPackageJson from '../../../../package.json';
|
import appPackageJson from '../../../../package.json';
|
||||||
import { globalBeforeEach } from '../../../__jest__/before-each';
|
import { globalBeforeEach } from '../../../__jest__/before-each';
|
||||||
|
@ -156,7 +156,6 @@ describe('app.export.*', () => {
|
|||||||
_id: 'res_1',
|
_id: 'res_1',
|
||||||
parentId: 'req_1',
|
parentId: 'req_1',
|
||||||
statusCode: 200,
|
statusCode: 200,
|
||||||
body: 'foo',
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -244,8 +243,8 @@ describe('app.export.*', () => {
|
|||||||
bodySize: -1,
|
bodySize: -1,
|
||||||
content: {
|
content: {
|
||||||
mimeType: '',
|
mimeType: '',
|
||||||
size: 3,
|
size: 0,
|
||||||
text: 'foo',
|
text: '',
|
||||||
},
|
},
|
||||||
cookies: [],
|
cookies: [],
|
||||||
headers: [],
|
headers: [],
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { createBuilder } from '@develohpanda/fluent-builder';
|
import { createBuilder } from '@develohpanda/fluent-builder';
|
||||||
import { mocked } from 'ts-jest/utils';
|
import { mocked } from 'jest-mock';
|
||||||
|
|
||||||
import { globalBeforeEach } from '../../../__jest__/before-each';
|
import { globalBeforeEach } from '../../../__jest__/before-each';
|
||||||
import { isLoggedIn as _isLoggedIn } from '../../../account/session';
|
import { isLoggedIn as _isLoggedIn } from '../../../account/session';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { createBuilder } from '@develohpanda/fluent-builder';
|
import { createBuilder } from '@develohpanda/fluent-builder';
|
||||||
import { mocked } from 'ts-jest/utils';
|
import { mocked } from 'jest-mock';
|
||||||
|
|
||||||
import { globalBeforeEach } from '../../../__jest__/before-each';
|
import { globalBeforeEach } from '../../../__jest__/before-each';
|
||||||
import { DEFAULT_BRANCH_NAME } from '../../../common/constants';
|
import { DEFAULT_BRANCH_NAME } from '../../../common/constants';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { renderHook } from '@testing-library/react-hooks';
|
import { renderHook } from '@testing-library/react-hooks';
|
||||||
|
import { mocked } from 'jest-mock';
|
||||||
import configureMockStore from 'redux-mock-store';
|
import configureMockStore from 'redux-mock-store';
|
||||||
import thunk from 'redux-thunk';
|
import thunk from 'redux-thunk';
|
||||||
import { mocked } from 'ts-jest/utils';
|
|
||||||
import { PromiseValue } from 'type-fest';
|
import { PromiseValue } from 'type-fest';
|
||||||
|
|
||||||
import { globalBeforeEach } from '../../../../__jest__/before-each';
|
import { globalBeforeEach } from '../../../../__jest__/before-each';
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
import { act, renderHook } from '@testing-library/react-hooks';
|
import { act, renderHook } from '@testing-library/react-hooks';
|
||||||
|
import { mocked } from 'jest-mock';
|
||||||
import configureMockStore from 'redux-mock-store';
|
import configureMockStore from 'redux-mock-store';
|
||||||
import thunk from 'redux-thunk';
|
import thunk from 'redux-thunk';
|
||||||
import { mocked } from 'ts-jest/utils';
|
|
||||||
|
|
||||||
import { globalBeforeEach } from '../../../__jest__/before-each';
|
import { globalBeforeEach } from '../../../__jest__/before-each';
|
||||||
import { reduxStateForTest } from '../../../__jest__/redux-state-for-test';
|
import { reduxStateForTest } from '../../../__jest__/redux-state-for-test';
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import { createBuilder } from '@develohpanda/fluent-builder';
|
import { createBuilder } from '@develohpanda/fluent-builder';
|
||||||
import { PromiseFsClient } from 'isomorphic-git';
|
import { PromiseFsClient } from 'isomorphic-git';
|
||||||
|
import { mocked } from 'jest-mock';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
import configureMockStore from 'redux-mock-store';
|
import configureMockStore from 'redux-mock-store';
|
||||||
import thunk from 'redux-thunk';
|
import thunk from 'redux-thunk';
|
||||||
import { mocked } from 'ts-jest/utils';
|
|
||||||
|
|
||||||
import { globalBeforeEach } from '../../../../__jest__/before-each';
|
import { globalBeforeEach } from '../../../../__jest__/before-each';
|
||||||
import { reduxStateForTest } from '../../../../__jest__/redux-state-for-test';
|
import { reduxStateForTest } from '../../../../__jest__/redux-state-for-test';
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
"**/main.min.js",
|
"**/main.min.js",
|
||||||
"__jest__",
|
"__jest__",
|
||||||
"assets",
|
"assets",
|
||||||
".babelrc.js",
|
|
||||||
"bin",
|
"bin",
|
||||||
"config",
|
"config",
|
||||||
"jest.config.js",
|
"jest.config.js",
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
/** @type { import('@jest/types').Config.InitialOptions } */
|
/** @type { import('@jest/types').Config.InitialOptions } */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
preset: '../../jest-preset.js',
|
preset: '../../jest-preset.js',
|
||||||
globals: {
|
|
||||||
'ts-jest': {
|
|
||||||
isolatedModules: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
13598
packages/openapi-2-kong/package-lock.json
generated
13598
packages/openapi-2-kong/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -25,7 +25,8 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/url-join": "^4.0.1",
|
"@types/url-join": "^4.0.1",
|
||||||
"@types/yaml": "^1.9.7",
|
"@types/yaml": "^1.9.7",
|
||||||
"jest": "^26.6.3",
|
"@jest/globals": "^28.1.0",
|
||||||
|
"jest": "^28.1.0",
|
||||||
"type-fest": "^2.12.0"
|
"type-fest": "^2.12.0"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { describe, expect, it } from '@jest/globals';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
distinctByProperty,
|
distinctByProperty,
|
||||||
fillServerVariables,
|
fillServerVariables,
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from '@jest/globals';
|
||||||
import { promises, readdirSync } from 'fs';
|
import { promises, readdirSync } from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { describe, expect, it } from '@jest/globals';
|
||||||
|
|
||||||
import { xKongName } from '../types/kong';
|
import { xKongName } from '../types/kong';
|
||||||
import { OA3PathItem, OpenApi3Spec } from '../types/openapi3';
|
import { OA3PathItem, OpenApi3Spec } from '../types/openapi3';
|
||||||
import { generateRouteName } from './services';
|
import { generateRouteName } from './services';
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
import { describe, expect, it } from '@jest/globals';
|
||||||
|
|
||||||
import { ParameterSchema, RequestTerminationPlugin, RequestValidatorPlugin, xKongPluginKeyAuth, xKongPluginRequestTermination, xKongPluginRequestValidator } from '../types/kong';
|
import { ParameterSchema, RequestTerminationPlugin, RequestValidatorPlugin, xKongPluginKeyAuth, xKongPluginRequestTermination, xKongPluginRequestValidator } from '../types/kong';
|
||||||
import { OA3Operation, OA3Parameter } from '../types/openapi3';
|
import { OA3Operation, OA3Parameter } from '../types/openapi3';
|
||||||
import { getSpec, pluginDummy, tags, UserDCPlugin } from './jest/test-helpers';
|
import { getSpec, pluginDummy, tags } from './jest/test-helpers';
|
||||||
import { ALLOW_ALL_SCHEMA, generateBodyOptions, generateGlobalPlugins, generateRequestValidatorPlugin } from './plugins';
|
import { ALLOW_ALL_SCHEMA, generateBodyOptions, generateGlobalPlugins, generateRequestValidatorPlugin } from './plugins';
|
||||||
|
|
||||||
describe('plugins', () => {
|
describe('plugins', () => {
|
||||||
describe('generateGlobalPlugins()', () => {
|
describe('generateGlobalPlugins()', () => {
|
||||||
it('generates plugin given a spec with a plugin attached', async () => {
|
it('generates plugin given a spec with a plugin attached', async () => {
|
||||||
@ -26,7 +27,7 @@ describe('plugins', () => {
|
|||||||
|
|
||||||
const result = generateGlobalPlugins(api, tags);
|
const result = generateGlobalPlugins(api, tags);
|
||||||
|
|
||||||
expect(result.plugins).toEqual<UserDCPlugin[]>([
|
expect(result.plugins).toEqual([
|
||||||
{
|
{
|
||||||
name: 'dummy',
|
name: 'dummy',
|
||||||
tags,
|
tags,
|
||||||
@ -78,13 +79,12 @@ describe('plugins', () => {
|
|||||||
|
|
||||||
const result = generateGlobalPlugins(spec, tags);
|
const result = generateGlobalPlugins(spec, tags);
|
||||||
|
|
||||||
expect(result.plugins).toEqual<RequestTerminationPlugin[]>([
|
expect(result.plugins as RequestTerminationPlugin[]).toEqual([
|
||||||
{
|
{
|
||||||
name: 'request-termination',
|
name: 'request-termination',
|
||||||
mad: 'max',
|
mad: 'max',
|
||||||
tags,
|
tags,
|
||||||
config: {
|
config: {
|
||||||
// @ts-expect-error this is intentionally passing in an extra property
|
|
||||||
max: 'is mad',
|
max: 'is mad',
|
||||||
status_code: 403,
|
status_code: 403,
|
||||||
message: 'So long and thanks for all the fish!',
|
message: 'So long and thanks for all the fish!',
|
||||||
@ -116,7 +116,7 @@ describe('plugins', () => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
const generated = generateRequestValidatorPlugin({ plugin, tags });
|
const generated = generateRequestValidatorPlugin({ plugin, tags });
|
||||||
expect(generated).toStrictEqual<RequestValidatorPlugin>({
|
expect(generated).toStrictEqual({
|
||||||
name: 'request-validator',
|
name: 'request-validator',
|
||||||
enabled: plugin.enabled,
|
enabled: plugin.enabled,
|
||||||
tags,
|
tags,
|
||||||
@ -141,7 +141,7 @@ describe('plugins', () => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
const generated = generateRequestValidatorPlugin({ plugin, tags });
|
const generated = generateRequestValidatorPlugin({ plugin, tags });
|
||||||
expect(generated).toStrictEqual<RequestValidatorPlugin>({
|
expect(generated).toStrictEqual({
|
||||||
name: 'request-validator',
|
name: 'request-validator',
|
||||||
enabled: plugin.enabled,
|
enabled: plugin.enabled,
|
||||||
tags,
|
tags,
|
||||||
@ -163,7 +163,7 @@ describe('plugins', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const generated1 = generateRequestValidatorPlugin({ plugin, tags });
|
const generated1 = generateRequestValidatorPlugin({ plugin, tags });
|
||||||
expect(generated1.config).toStrictEqual<RequestValidatorPlugin['config']>({
|
expect(generated1.config).toStrictEqual({
|
||||||
version: 'draft4',
|
version: 'draft4',
|
||||||
body_schema: ALLOW_ALL_SCHEMA,
|
body_schema: ALLOW_ALL_SCHEMA,
|
||||||
});
|
});
|
||||||
@ -175,7 +175,7 @@ describe('plugins', () => {
|
|||||||
},
|
},
|
||||||
tags,
|
tags,
|
||||||
});
|
});
|
||||||
expect(generated2.config).toStrictEqual<RequestValidatorPlugin['config']>({
|
expect(generated2.config).toStrictEqual({
|
||||||
version: 'draft4',
|
version: 'draft4',
|
||||||
body_schema: ALLOW_ALL_SCHEMA,
|
body_schema: ALLOW_ALL_SCHEMA,
|
||||||
});
|
});
|
||||||
@ -200,7 +200,7 @@ describe('plugins', () => {
|
|||||||
parameters: [param],
|
parameters: [param],
|
||||||
};
|
};
|
||||||
const generated = generateRequestValidatorPlugin({ tags, operation });
|
const generated = generateRequestValidatorPlugin({ tags, operation });
|
||||||
expect(generated.config).toStrictEqual<RequestValidatorPlugin['config']>({
|
expect(generated.config).toStrictEqual({
|
||||||
version: 'draft4',
|
version: 'draft4',
|
||||||
parameter_schema: [
|
parameter_schema: [
|
||||||
{
|
{
|
||||||
@ -225,7 +225,7 @@ describe('plugins', () => {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
const generated = generateRequestValidatorPlugin({ tags, operation });
|
const generated = generateRequestValidatorPlugin({ tags, operation });
|
||||||
expect(generated.config).toStrictEqual<RequestValidatorPlugin['config']>({
|
expect(generated.config).toStrictEqual({
|
||||||
version: 'draft4',
|
version: 'draft4',
|
||||||
parameter_schema: [
|
parameter_schema: [
|
||||||
{
|
{
|
||||||
@ -266,7 +266,7 @@ describe('plugins', () => {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
const generated = generateRequestValidatorPlugin({ tags, operation });
|
const generated = generateRequestValidatorPlugin({ tags, operation });
|
||||||
expect(generated.config).toStrictEqual<RequestValidatorPlugin['config']>({
|
expect(generated.config).toStrictEqual({
|
||||||
version: 'draft4',
|
version: 'draft4',
|
||||||
parameter_schema: [
|
parameter_schema: [
|
||||||
{
|
{
|
||||||
@ -299,7 +299,7 @@ describe('plugins', () => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
const generated = generateRequestValidatorPlugin({ plugin, tags });
|
const generated = generateRequestValidatorPlugin({ plugin, tags });
|
||||||
expect(generated.config).toStrictEqual<RequestValidatorPlugin['config']>({
|
expect(generated.config).toStrictEqual({
|
||||||
version: 'draft4',
|
version: 'draft4',
|
||||||
body_schema: ALLOW_ALL_SCHEMA,
|
body_schema: ALLOW_ALL_SCHEMA,
|
||||||
});
|
});
|
||||||
@ -339,7 +339,7 @@ describe('plugins', () => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
const generated = generateRequestValidatorPlugin({ tags, operation });
|
const generated = generateRequestValidatorPlugin({ tags, operation });
|
||||||
expect(generated.config).toStrictEqual<RequestValidatorPlugin['config']>({
|
expect(generated.config).toStrictEqual({
|
||||||
version: 'draft4',
|
version: 'draft4',
|
||||||
body_schema: ALLOW_ALL_SCHEMA,
|
body_schema: ALLOW_ALL_SCHEMA,
|
||||||
allowed_content_types: ['application/xml', 'text/yaml'],
|
allowed_content_types: ['application/xml', 'text/yaml'],
|
||||||
@ -378,7 +378,7 @@ describe('plugins', () => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
const generated = generateRequestValidatorPlugin({ tags, operation });
|
const generated = generateRequestValidatorPlugin({ tags, operation });
|
||||||
expect(generated.config).toStrictEqual<RequestValidatorPlugin['config']>({
|
expect(generated.config).toStrictEqual({
|
||||||
version: 'draft4',
|
version: 'draft4',
|
||||||
body_schema: JSON.stringify(schemaJson),
|
body_schema: JSON.stringify(schemaJson),
|
||||||
allowed_content_types: ['application/xml', 'application/json'],
|
allowed_content_types: ['application/xml', 'application/json'],
|
||||||
@ -387,7 +387,7 @@ describe('plugins', () => {
|
|||||||
|
|
||||||
it('should default body_schema if no schema is defined or generated', () => {
|
it('should default body_schema if no schema is defined or generated', () => {
|
||||||
const generated = generateRequestValidatorPlugin({ tags, operation: {} });
|
const generated = generateRequestValidatorPlugin({ tags, operation: {} });
|
||||||
expect(generated.config).toStrictEqual<RequestValidatorPlugin['config']>({
|
expect(generated.config).toStrictEqual({
|
||||||
version: 'draft4',
|
version: 'draft4',
|
||||||
body_schema: ALLOW_ALL_SCHEMA,
|
body_schema: ALLOW_ALL_SCHEMA,
|
||||||
});
|
});
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { describe, expect, it } from '@jest/globals';
|
||||||
|
|
||||||
import { OA3SecurityScheme, OA3SecuritySchemeOpenIdConnect } from '../types/openapi3';
|
import { OA3SecurityScheme, OA3SecuritySchemeOpenIdConnect } from '../types/openapi3';
|
||||||
import { tags } from './jest/test-helpers';
|
import { tags } from './jest/test-helpers';
|
||||||
import { generateSecurityPlugin } from './security-plugins';
|
import { generateSecurityPlugin } from './security-plugins';
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { describe, expect, it } from '@jest/globals';
|
||||||
|
|
||||||
import { OA3Operation } from '../types';
|
import { OA3Operation } from '../types';
|
||||||
import { DCRoute, DCService } from '../types/declarative-config';
|
import { DCRoute, DCService } from '../types/declarative-config';
|
||||||
import { xKongPluginKeyAuth, xKongPluginRequestValidator, xKongRouteDefaults } from '../types/kong';
|
import { xKongPluginKeyAuth, xKongPluginRequestValidator, xKongRouteDefaults } from '../types/kong';
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { describe, expect, it } from '@jest/globals';
|
||||||
|
|
||||||
import { KeyAuthPlugin, xKongPluginKeyAuth } from '../types/kong';
|
import { KeyAuthPlugin, xKongPluginKeyAuth } from '../types/kong';
|
||||||
import { getSpec, tags } from './jest/test-helpers';
|
import { getSpec, tags } from './jest/test-helpers';
|
||||||
import { generatePlugins } from './plugins';
|
import { generatePlugins } from './plugins';
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { describe, expect, it } from '@jest/globals';
|
||||||
|
|
||||||
import { DCUpstream } from '../types';
|
import { DCUpstream } from '../types';
|
||||||
import { xKongUpstreamDefaults } from '../types/kong';
|
import { xKongUpstreamDefaults } from '../types/kong';
|
||||||
import { getSpec, tags } from './jest/test-helpers';
|
import { getSpec, tags } from './jest/test-helpers';
|
||||||
@ -22,7 +24,7 @@ describe('upstreams', () => {
|
|||||||
it('generates an upstream', () => {
|
it('generates an upstream', () => {
|
||||||
const spec = getSpec();
|
const spec = getSpec();
|
||||||
const specResult = getSpecResult();
|
const specResult = getSpecResult();
|
||||||
expect(generateUpstreams(spec, tags)).toEqual<DCUpstream[]>([specResult]);
|
expect(generateUpstreams(spec, tags)).toEqual([specResult]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('throws for a root level x-kong-route-default', () => {
|
it('throws for a root level x-kong-route-default', () => {
|
||||||
@ -42,7 +44,7 @@ describe('upstreams', () => {
|
|||||||
[xKongUpstreamDefaults]: null,
|
[xKongUpstreamDefaults]: null,
|
||||||
});
|
});
|
||||||
const specResult = getSpecResult();
|
const specResult = getSpecResult();
|
||||||
expect(generateUpstreams(spec, tags)).toEqual<DCUpstream[]>([specResult]);
|
expect(generateUpstreams(spec, tags)).toEqual([specResult]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('generates upstream name by appending .upstream', () => {
|
it('generates upstream name by appending .upstream', () => {
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
|
import { describe, expect, it } from '@jest/globals';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import YAML from 'yaml';
|
import YAML from 'yaml';
|
||||||
|
|
||||||
import { generate, generateFromSpec, generateFromString, parseSpec } from './generate';
|
import { generate, generateFromSpec, generateFromString, parseSpec } from './generate';
|
||||||
import { K8sKongIngress } from './types/kubernetes-config';
|
|
||||||
import { OpenApi3Spec } from './types/openapi3';
|
import { OpenApi3Spec } from './types/openapi3';
|
||||||
import { DeclarativeConfigResult, KongForKubernetesResult } from './types/outputs';
|
import { DeclarativeConfigResult, KongForKubernetesResult } from './types/outputs';
|
||||||
|
|
||||||
const firstK8sDocument: K8sKongIngress = {
|
const firstK8sDocument = {
|
||||||
apiVersion: 'configuration.konghq.com/v1',
|
apiVersion: 'configuration.konghq.com/v1',
|
||||||
kind: 'KongIngress',
|
kind: 'KongIngress',
|
||||||
metadata: {
|
metadata: {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from '@jest/globals';
|
||||||
import { promises, readdirSync } from 'fs';
|
import { promises, readdirSync } from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import YAML from 'yaml';
|
import YAML from 'yaml';
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
import { describe, expect, it } from '@jest/globals';
|
||||||
|
|
||||||
import { dummyName, dummyPluginDoc, getSpec, pluginDummy } from '../declarative-config/jest/test-helpers';
|
import { dummyName, dummyPluginDoc, getSpec, pluginDummy } from '../declarative-config/jest/test-helpers';
|
||||||
import { xKongName } from '../types/kong';
|
import { xKongName } from '../types/kong';
|
||||||
import { K8sAnnotations, K8sIngressRule, K8sIngressTLS, K8sManifest } from '../types/kubernetes-config';
|
import { K8sAnnotations, K8sIngressTLS } from '../types/kubernetes-config';
|
||||||
import { OA3Server } from '../types/openapi3';
|
import { OA3Server } from '../types/openapi3';
|
||||||
import {
|
import {
|
||||||
generateIngressRule,
|
generateIngressRule,
|
||||||
@ -66,7 +68,7 @@ describe('index', () => {
|
|||||||
const result = generateMetadataAnnotations(spec, {
|
const result = generateMetadataAnnotations(spec, {
|
||||||
pluginNames: [],
|
pluginNames: [],
|
||||||
});
|
});
|
||||||
expect(result).toEqual<K8sAnnotations>({
|
expect(result).toEqual({
|
||||||
'kubernetes.io/ingress.class': 'kong',
|
'kubernetes.io/ingress.class': 'kong',
|
||||||
'nginx.ingress.kubernetes.io/rewrite-target': '/',
|
'nginx.ingress.kubernetes.io/rewrite-target': '/',
|
||||||
});
|
});
|
||||||
@ -77,7 +79,7 @@ describe('index', () => {
|
|||||||
const result = generateMetadataAnnotations(spec, {
|
const result = generateMetadataAnnotations(spec, {
|
||||||
pluginNames: [],
|
pluginNames: [],
|
||||||
});
|
});
|
||||||
expect(result).toEqual<K8sAnnotations>({
|
expect(result).toEqual({
|
||||||
'kubernetes.io/ingress.class': 'kong',
|
'kubernetes.io/ingress.class': 'kong',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -87,7 +89,7 @@ describe('index', () => {
|
|||||||
const result = generateMetadataAnnotations(spec, {
|
const result = generateMetadataAnnotations(spec, {
|
||||||
pluginNames: ['one', 'two'],
|
pluginNames: ['one', 'two'],
|
||||||
});
|
});
|
||||||
expect(result).toEqual<K8sAnnotations>({
|
expect(result).toEqual({
|
||||||
'kubernetes.io/ingress.class': 'kong',
|
'kubernetes.io/ingress.class': 'kong',
|
||||||
'konghq.com/plugins': 'one, two',
|
'konghq.com/plugins': 'one, two',
|
||||||
});
|
});
|
||||||
@ -99,7 +101,7 @@ describe('index', () => {
|
|||||||
pluginNames: [],
|
pluginNames: [],
|
||||||
overrideName: 'name',
|
overrideName: 'name',
|
||||||
});
|
});
|
||||||
expect(result).toEqual<K8sAnnotations>({
|
expect(result).toEqual({
|
||||||
'kubernetes.io/ingress.class': 'kong',
|
'kubernetes.io/ingress.class': 'kong',
|
||||||
'konghq.com/override': 'name',
|
'konghq.com/override': 'name',
|
||||||
});
|
});
|
||||||
@ -121,7 +123,7 @@ describe('index', () => {
|
|||||||
pluginNames: ['one', 'two'],
|
pluginNames: ['one', 'two'],
|
||||||
overrideName: 'name',
|
overrideName: 'name',
|
||||||
});
|
});
|
||||||
expect(result).toEqual<K8sAnnotations>({
|
expect(result).toEqual({
|
||||||
'kubernetes.io/ingress.class': 'kong',
|
'kubernetes.io/ingress.class': 'kong',
|
||||||
'nginx.ingress.kubernetes.io/rewrite-target': '/',
|
'nginx.ingress.kubernetes.io/rewrite-target': '/',
|
||||||
'konghq.com/plugins': 'one, two',
|
'konghq.com/plugins': 'one, two',
|
||||||
@ -129,7 +131,7 @@ describe('index', () => {
|
|||||||
});
|
});
|
||||||
// Should not modify source metadata annotations object
|
// Should not modify source metadata annotations object
|
||||||
const sourceMetadata = spec.info['x-kubernetes-ingress-metadata']?.annotations;
|
const sourceMetadata = spec.info['x-kubernetes-ingress-metadata']?.annotations;
|
||||||
expect(sourceMetadata).toStrictEqual<K8sAnnotations>(annotations);
|
expect(sourceMetadata).toStrictEqual(annotations);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -321,7 +323,7 @@ describe('index', () => {
|
|||||||
},
|
},
|
||||||
'my-ingress',
|
'my-ingress',
|
||||||
);
|
);
|
||||||
expect(result).toStrictEqual<K8sIngressRule>({
|
expect(result).toStrictEqual({
|
||||||
host: 'api.insomnia.rest',
|
host: 'api.insomnia.rest',
|
||||||
http: {
|
http: {
|
||||||
paths: [
|
paths: [
|
||||||
@ -532,9 +534,8 @@ describe('index', () => {
|
|||||||
it('handles global plugins', () => {
|
it('handles global plugins', () => {
|
||||||
const spec = getSpec({ servers, ...pluginKeyAuth, ...pluginDummy });
|
const spec = getSpec({ servers, ...pluginKeyAuth, ...pluginDummy });
|
||||||
const result = generateKongForKubernetesConfigFromSpec(spec);
|
const result = generateKongForKubernetesConfigFromSpec(spec);
|
||||||
expect(result.documents).toStrictEqual<K8sManifest[]>([
|
expect(result.documents).toStrictEqual([
|
||||||
keyAuthPluginDoc('g0'),
|
keyAuthPluginDoc('g0'),
|
||||||
// @ts-expect-error -- TSCONVERSION more work is needed to module augment to include DummyPlugin (but not export those augmentations)
|
|
||||||
dummyPluginDoc('g1'),
|
dummyPluginDoc('g1'),
|
||||||
ingressDoc(0, [keyAuthName('g0'), dummyName('g1')], 'api.insomnia.rest', 'my-api-service-0'),
|
ingressDoc(0, [keyAuthName('g0'), dummyName('g1')], 'api.insomnia.rest', 'my-api-service-0'),
|
||||||
]);
|
]);
|
||||||
@ -559,11 +560,10 @@ describe('index', () => {
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
const result = generateKongForKubernetesConfigFromSpec(spec);
|
const result = generateKongForKubernetesConfigFromSpec(spec);
|
||||||
expect(result.documents).toStrictEqual<K8sManifest[]>([
|
expect(result.documents).toStrictEqual([
|
||||||
keyAuthPluginDoc('g0'),
|
keyAuthPluginDoc('g0'),
|
||||||
keyAuthPluginDoc('s1'),
|
keyAuthPluginDoc('s1'),
|
||||||
keyAuthPluginDoc('s2'),
|
keyAuthPluginDoc('s2'),
|
||||||
// @ts-expect-error -- TSCONVERSION more work is needed to module augment to include DummyPlugin (but not export those augmentations)
|
|
||||||
dummyPluginDoc('s3'),
|
dummyPluginDoc('s3'),
|
||||||
ingressDoc(0, [keyAuthName('g0')], 'api-0.insomnia.rest', 'my-api-service-0'),
|
ingressDoc(0, [keyAuthName('g0')], 'api-0.insomnia.rest', 'my-api-service-0'),
|
||||||
ingressDoc(1, [keyAuthName('s1')], 'api-1.insomnia.rest', 'my-api-service-1'),
|
ingressDoc(1, [keyAuthName('s1')], 'api-1.insomnia.rest', 'my-api-service-1'),
|
||||||
@ -587,11 +587,10 @@ describe('index', () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
const result = generateKongForKubernetesConfigFromSpec(spec);
|
const result = generateKongForKubernetesConfigFromSpec(spec);
|
||||||
expect(result.documents).toStrictEqual<K8sManifest[]>([
|
expect(result.documents).toStrictEqual([
|
||||||
keyAuthPluginDoc('g0'),
|
keyAuthPluginDoc('g0'),
|
||||||
keyAuthPluginDoc('p1'),
|
keyAuthPluginDoc('p1'),
|
||||||
keyAuthPluginDoc('p2'),
|
keyAuthPluginDoc('p2'),
|
||||||
// @ts-expect-error -- TSCONVERSION more work is needed to module augment to include DummyPlugin (but not export those augmentations)
|
|
||||||
dummyPluginDoc('p3'),
|
dummyPluginDoc('p3'),
|
||||||
ingressDoc(0, [keyAuthName('g0')], 'api.insomnia.rest', 'my-api-service-0', '/no-plugin'),
|
ingressDoc(0, [keyAuthName('g0')], 'api.insomnia.rest', 'my-api-service-0', '/no-plugin'),
|
||||||
ingressDoc(1, [keyAuthName('p1')], 'api.insomnia.rest', 'my-api-service-0', '/plugin-0'),
|
ingressDoc(1, [keyAuthName('p1')], 'api.insomnia.rest', 'my-api-service-0', '/plugin-0'),
|
||||||
@ -618,14 +617,13 @@ describe('index', () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
const result = generateKongForKubernetesConfigFromSpec(spec);
|
const result = generateKongForKubernetesConfigFromSpec(spec);
|
||||||
expect(result.documents).toStrictEqual<K8sManifest[]>([
|
expect(result.documents).toStrictEqual([
|
||||||
methodDoc('get'),
|
methodDoc('get'),
|
||||||
methodDoc('put'),
|
methodDoc('put'),
|
||||||
methodDoc('post'),
|
methodDoc('post'),
|
||||||
keyAuthPluginDoc('g0'),
|
keyAuthPluginDoc('g0'),
|
||||||
keyAuthPluginDoc('m1'),
|
keyAuthPluginDoc('m1'),
|
||||||
keyAuthPluginDoc('m2'),
|
keyAuthPluginDoc('m2'),
|
||||||
// @ts-expect-error -- TSCONVERSION more work is needed to module augment to include DummyPlugin (but not export those augmentations)
|
|
||||||
dummyPluginDoc('m3'),
|
dummyPluginDoc('m3'),
|
||||||
ingressDocWithOverride(
|
ingressDocWithOverride(
|
||||||
0,
|
0,
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
import { beforeEach, describe, expect, it, jest } from '@jest/globals';
|
||||||
|
|
||||||
import { HttpMethod } from '../common';
|
import { HttpMethod } from '../common';
|
||||||
import { dummyPluginDoc, pluginDummy, UserK8sPlugin } from '../declarative-config/jest/test-helpers';
|
import { dummyPluginDoc, pluginDummy } from '../declarative-config/jest/test-helpers';
|
||||||
import { OperationPlugin, PathPlugin } from '../types/k8s-plugins';
|
import { IndexIncrement, OperationPlugin, PathPlugin } from '../types/k8s-plugins';
|
||||||
import {
|
import {
|
||||||
OA3Components,
|
OA3Components,
|
||||||
OA3Operation,
|
OA3Operation,
|
||||||
@ -165,7 +167,7 @@ describe('plugins', () => {
|
|||||||
it('returns multiple plugin docs', () => {
|
it('returns multiple plugin docs', () => {
|
||||||
const api: OpenApi3Spec = { ...spec, ...pluginKeyAuth, ...pluginDummy };
|
const api: OpenApi3Spec = { ...spec, ...pluginKeyAuth, ...pluginDummy };
|
||||||
const result = getGlobalPlugins(api, increment);
|
const result = getGlobalPlugins(api, increment);
|
||||||
expect(result).toEqual<UserK8sPlugin[]>([keyAuthPluginDoc('g0'), dummyPluginDoc('g1')]);
|
expect(result).toEqual([keyAuthPluginDoc('g0'), dummyPluginDoc('g1')]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns security plugin doc', () => {
|
it('returns security plugin doc', () => {
|
||||||
@ -430,7 +432,7 @@ describe('plugins', () => {
|
|||||||
|
|
||||||
describe('generateK8sPluginConfig()', () => {
|
describe('generateK8sPluginConfig()', () => {
|
||||||
it('should return empty array if no plugin keys found and not increment', () => {
|
it('should return empty array if no plugin keys found and not increment', () => {
|
||||||
const incrementMock = jest.fn().mockReturnValue(0);
|
const incrementMock = jest.fn<IndexIncrement>().mockReturnValue(0);
|
||||||
const result = generateK8sPluginConfig(spec, 's', incrementMock);
|
const result = generateK8sPluginConfig(spec, 's', incrementMock);
|
||||||
expect(result).toHaveLength(0);
|
expect(result).toHaveLength(0);
|
||||||
expect(incrementMock).not.toHaveBeenCalled();
|
expect(incrementMock).not.toHaveBeenCalled();
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { describe, expect, it } from '@jest/globals';
|
||||||
|
|
||||||
import { OA3ServerVariable } from '../types/openapi3';
|
import { OA3ServerVariable } from '../types/openapi3';
|
||||||
import { pathVariablesToWildcard, resolveUrlVariables, resolveVariables } from './variables';
|
import { pathVariablesToWildcard, resolveUrlVariables, resolveVariables } from './variables';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user