1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-21 13:47:39 +02:00

task: use swc instead of ts-jest (#2042)

This commit is contained in:
Christopher Kolstad 2022-09-06 13:22:41 +02:00 committed by GitHub
parent 03ddb0ad74
commit 8648649047
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 3128 additions and 3326 deletions

View File

@ -57,7 +57,9 @@
"testTimeout": 10000, "testTimeout": 10000,
"globalSetup": "./scripts/jest-setup.js", "globalSetup": "./scripts/jest-setup.js",
"transform": { "transform": {
"^.+\\.tsx?$": "ts-jest" "^.+\\.tsx?$": [
"@swc/jest"
]
}, },
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$", "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"testPathIgnorePatterns": [ "testPathIgnorePatterns": [
@ -138,7 +140,7 @@
"@types/express": "4.17.13", "@types/express": "4.17.13",
"@types/express-session": "1.17.5", "@types/express-session": "1.17.5",
"@types/faker": "5.5.9", "@types/faker": "5.5.9",
"@types/jest": "27.5.2", "@types/jest": "29.0.0",
"@types/js-yaml": "4.0.5", "@types/js-yaml": "4.0.5",
"@types/make-fetch-happen": "10.0.0", "@types/make-fetch-happen": "10.0.0",
"@types/memoizee": "0.4.8", "@types/memoizee": "0.4.8",
@ -166,7 +168,7 @@
"fast-check": "3.1.2", "fast-check": "3.1.2",
"fetch-mock": "9.11.0", "fetch-mock": "9.11.0",
"husky": "8.0.1", "husky": "8.0.1",
"jest": "27.5.1", "jest": "29.0.1",
"lint-staged": "13.0.3", "lint-staged": "13.0.3",
"nock": "13.2.9", "nock": "13.2.9",
"prettier": "2.7.1", "prettier": "2.7.1",
@ -174,7 +176,8 @@
"source-map-support": "0.5.21", "source-map-support": "0.5.21",
"superagent": "8.0.0", "superagent": "8.0.0",
"supertest": "6.2.4", "supertest": "6.2.4",
"ts-jest": "27.1.5", "@swc/core": "1.2.246",
"@swc/jest": "0.2.22",
"ts-node": "10.9.1", "ts-node": "10.9.1",
"tsc-watch": "5.0.3", "tsc-watch": "5.0.3",
"typescript": "4.8.2" "typescript": "4.8.2"

View File

@ -1,26 +1,26 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`should create default config 1`] = ` exports[`should create default config 1`] = `
Object { {
"additionalCspAllowedDomains": Object { "additionalCspAllowedDomains": {
"defaultSrc": Array [], "defaultSrc": [],
"fontSrc": Array [], "fontSrc": [],
"imgSrc": Array [], "imgSrc": [],
"scriptSrc": Array [], "scriptSrc": [],
"styleSrc": Array [], "styleSrc": [],
}, },
"authentication": Object { "authentication": {
"createAdminUser": true, "createAdminUser": true,
"customAuthHandler": [Function], "customAuthHandler": [Function],
"enableApiToken": true, "enableApiToken": true,
"initApiTokens": Array [], "initApiTokens": [],
"type": "open-source", "type": "open-source",
}, },
"clientFeatureCaching": Object { "clientFeatureCaching": {
"enabled": true, "enabled": true,
"maxAge": 600, "maxAge": 600,
}, },
"db": Object { "db": {
"acquireConnectionTimeout": 30000, "acquireConnectionTimeout": 30000,
"applicationName": "unleash", "applicationName": "unleash",
"database": "unleash_db", "database": "unleash_db",
@ -28,7 +28,7 @@ Object {
"driver": "postgres", "driver": "postgres",
"host": "localhost", "host": "localhost",
"password": "password", "password": "password",
"pool": Object { "pool": {
"idleTimeoutMillis": 30000, "idleTimeoutMillis": 30000,
"max": 4, "max": 4,
"min": 0, "min": 0,
@ -36,14 +36,14 @@ Object {
}, },
"port": 4242, "port": 4242,
"schema": "public", "schema": "public",
"ssl": Object { "ssl": {
"rejectUnauthorized": false, "rejectUnauthorized": false,
}, },
"user": "unleash", "user": "unleash",
"version": undefined, "version": undefined,
}, },
"disableLegacyFeaturesApi": false, "disableLegacyFeaturesApi": false,
"email": Object { "email": {
"host": undefined, "host": undefined,
"port": 587, "port": 587,
"secure": false, "secure": false,
@ -53,19 +53,19 @@ Object {
}, },
"enableOAS": false, "enableOAS": false,
"enterpriseVersion": undefined, "enterpriseVersion": undefined,
"environmentEnableOverrides": Array [], "environmentEnableOverrides": [],
"eventBus": EventEmitter { "eventBus": EventEmitter {
"_events": Object {}, "_events": {},
"_eventsCount": 0, "_eventsCount": 0,
"_maxListeners": undefined, "_maxListeners": undefined,
Symbol(kCapture): false, Symbol(kCapture): false,
}, },
"eventHook": undefined, "eventHook": undefined,
"experimental": Object { "experimental": {
"externalResolver": Object { "externalResolver": {
"isEnabled": [Function], "isEnabled": [Function],
}, },
"flags": Object { "flags": {
"ENABLE_DARK_MODE_SUPPORT": false, "ENABLE_DARK_MODE_SUPPORT": false,
"anonymiseEventLog": false, "anonymiseEventLog": false,
"batchMetrics": false, "batchMetrics": false,
@ -74,28 +74,28 @@ Object {
}, },
}, },
"flagResolver": FlagResolver { "flagResolver": FlagResolver {
"experiments": Object { "experiments": {
"ENABLE_DARK_MODE_SUPPORT": false, "ENABLE_DARK_MODE_SUPPORT": false,
"anonymiseEventLog": false, "anonymiseEventLog": false,
"batchMetrics": false, "batchMetrics": false,
"embedProxy": false, "embedProxy": false,
"embedProxyFrontend": false, "embedProxyFrontend": false,
}, },
"externalResolver": Object { "externalResolver": {
"isEnabled": [Function], "isEnabled": [Function],
}, },
}, },
"frontendApiOrigins": Array [ "frontendApiOrigins": [
"*", "*",
], ],
"getLogger": [Function], "getLogger": [Function],
"import": Object { "import": {
"dropBeforeImport": false, "dropBeforeImport": false,
"file": undefined, "file": undefined,
"keepExisting": false, "keepExisting": false,
}, },
"inlineSegmentConstraints": true, "inlineSegmentConstraints": true,
"listen": Object { "listen": {
"host": undefined, "host": undefined,
"port": 4242, "port": 4242,
}, },
@ -103,7 +103,7 @@ Object {
"preRouterHook": undefined, "preRouterHook": undefined,
"secureHeaders": false, "secureHeaders": false,
"segmentValuesLimit": 100, "segmentValuesLimit": 100,
"server": Object { "server": {
"baseUriPath": "", "baseUriPath": "",
"cdnPrefix": undefined, "cdnPrefix": undefined,
"enableRequestLogger": false, "enableRequestLogger": false,
@ -118,20 +118,20 @@ Object {
"serverMetrics": true, "serverMetrics": true,
"unleashUrl": "http://localhost:4242", "unleashUrl": "http://localhost:4242",
}, },
"session": Object { "session": {
"clearSiteDataOnLogout": true, "clearSiteDataOnLogout": true,
"cookieName": "unleash-session", "cookieName": "unleash-session",
"db": true, "db": true,
"ttlHours": 48, "ttlHours": 48,
}, },
"strategySegmentsLimit": 5, "strategySegmentsLimit": 5,
"ui": Object { "ui": {
"flags": Object { "flags": {
"E": true, "E": true,
"ENABLE_DARK_MODE_SUPPORT": false, "ENABLE_DARK_MODE_SUPPORT": false,
}, },
}, },
"versionCheck": Object { "versionCheck": {
"enable": true, "enable": true,
"url": "https://version.unleash.run", "url": "https://version.unleash.run",
}, },

View File

@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Should call datadog webhook for archived toggle 1`] = `"{\\"text\\":\\"%%% \\\\n some@user.com just archived feature toggle *[some-toggle](http://some-url.com/archive)* \\\\n %%% \\",\\"title\\":\\"Unleash notification update\\"}"`; exports[`Should call datadog webhook for archived toggle 1`] = `"{"text":"%%% \\n some@user.com just archived feature toggle *[some-toggle](http://some-url.com/archive)* \\n %%% ","title":"Unleash notification update"}"`;
exports[`Should call datadog webhook 1`] = `"{\\"text\\":\\"%%% \\\\n some@user.com created feature toggle [some-toggle](http://some-url.com/projects//some-toggle) in project *undefined* \\\\n %%% \\",\\"title\\":\\"Unleash notification update\\"}"`; exports[`Should call datadog webhook 1`] = `"{"text":"%%% \\n some@user.com created feature toggle [some-toggle](http://some-url.com/projects//some-toggle) in project *undefined* \\n %%% ","title":"Unleash notification update"}"`;
exports[`Should call datadog webhook for toggled environment 1`] = `"{\\"text\\":\\"%%% \\\\n some@user.com *disabled* [some-toggle](http://some-url.com/projects/default/some-toggle) in *development* environment in project *default* \\\\n %%% \\",\\"title\\":\\"Unleash notification update\\"}"`; exports[`Should call datadog webhook for toggled environment 1`] = `"{"text":"%%% \\n some@user.com *disabled* [some-toggle](http://some-url.com/projects/default/some-toggle) in *development* environment in project *default* \\n %%% ","title":"Unleash notification update"}"`;

View File

@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Should call slack webhook 1`] = `"{\\"username\\":\\"Unleash\\",\\"icon_emoji\\":\\":unleash:\\",\\"text\\":\\"some@user.com created feature toggle <http://some-url.com/projects/default/some-toggle|some-toggle> in project *default*\\",\\"channel\\":\\"#undefined\\",\\"attachments\\":[{\\"actions\\":[{\\"name\\":\\"featureToggle\\",\\"text\\":\\"Open in Unleash\\",\\"type\\":\\"button\\",\\"value\\":\\"featureToggle\\",\\"style\\":\\"primary\\",\\"url\\":\\"http://some-url.com/projects/default/some-toggle\\"}]}]}"`; exports[`Should call slack webhook 1`] = `"{"username":"Unleash","icon_emoji":":unleash:","text":"some@user.com created feature toggle <http://some-url.com/projects/default/some-toggle|some-toggle> in project *default*","channel":"#undefined","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/projects/default/some-toggle"}]}]}"`;
exports[`Should call slack webhook for archived toggle 1`] = `"{\\"username\\":\\"Unleash\\",\\"icon_emoji\\":\\":unleash:\\",\\"text\\":\\" some@user.com just archived feature toggle *<http://some-url.com/archive|some-toggle>*\\",\\"channel\\":\\"#undefined\\",\\"attachments\\":[{\\"actions\\":[{\\"name\\":\\"featureToggle\\",\\"text\\":\\"Open in Unleash\\",\\"type\\":\\"button\\",\\"value\\":\\"featureToggle\\",\\"style\\":\\"primary\\",\\"url\\":\\"http://some-url.com/archive\\"}]}]}"`; exports[`Should call slack webhook for archived toggle 1`] = `"{"username":"Unleash","icon_emoji":":unleash:","text":" some@user.com just archived feature toggle *<http://some-url.com/archive|some-toggle>*","channel":"#undefined","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/archive"}]}]}"`;
exports[`Should call webhook for toggled environment 1`] = `"{\\"username\\":\\"Unleash\\",\\"icon_emoji\\":\\":unleash:\\",\\"text\\":\\"some@user.com *disabled* <http://some-url.com/projects/default/some-toggle|some-toggle> in *development* environment in project *default*\\",\\"channel\\":\\"#undefined\\",\\"attachments\\":[{\\"actions\\":[{\\"name\\":\\"featureToggle\\",\\"text\\":\\"Open in Unleash\\",\\"type\\":\\"button\\",\\"value\\":\\"featureToggle\\",\\"style\\":\\"primary\\",\\"url\\":\\"http://some-url.com/projects/default/some-toggle\\"}]}]}"`; exports[`Should call webhook for toggled environment 1`] = `"{"username":"Unleash","icon_emoji":":unleash:","text":"some@user.com *disabled* <http://some-url.com/projects/default/some-toggle|some-toggle> in *development* environment in project *default*","channel":"#undefined","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/projects/default/some-toggle"}]}]}"`;

View File

@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Should call teams webhook 1`] = `"{\\"themeColor\\":\\"0076D7\\",\\"summary\\":\\"Message\\",\\"sections\\":[{\\"activityTitle\\":\\"some@user.com created feature toggle [some-toggle](http://some-url.com/projects//some-toggle) in project *undefined*\\",\\"activitySubtitle\\":\\"Unleash notification update\\",\\"facts\\":[{\\"name\\":\\"User\\",\\"value\\":\\"some@user.com\\"},{\\"name\\":\\"Action\\",\\"value\\":\\"feature-created\\"}]}],\\"potentialAction\\":[{\\"@type\\":\\"OpenUri\\",\\"name\\":\\"Go to feature\\",\\"targets\\":[{\\"os\\":\\"default\\",\\"uri\\":\\"http://some-url.com/projects//some-toggle\\"}]}]}"`; exports[`Should call teams webhook 1`] = `"{"themeColor":"0076D7","summary":"Message","sections":[{"activityTitle":"some@user.com created feature toggle [some-toggle](http://some-url.com/projects//some-toggle) in project *undefined*","activitySubtitle":"Unleash notification update","facts":[{"name":"User","value":"some@user.com"},{"name":"Action","value":"feature-created"}]}],"potentialAction":[{"@type":"OpenUri","name":"Go to feature","targets":[{"os":"default","uri":"http://some-url.com/projects//some-toggle"}]}]}"`;
exports[`Should call teams webhook for archived toggle 1`] = `"{\\"themeColor\\":\\"0076D7\\",\\"summary\\":\\"Message\\",\\"sections\\":[{\\"activityTitle\\":\\" some@user.com just archived feature toggle *[some-toggle](http://some-url.com/archive)*\\",\\"activitySubtitle\\":\\"Unleash notification update\\",\\"facts\\":[{\\"name\\":\\"User\\",\\"value\\":\\"some@user.com\\"},{\\"name\\":\\"Action\\",\\"value\\":\\"feature-archived\\"}]}],\\"potentialAction\\":[{\\"@type\\":\\"OpenUri\\",\\"name\\":\\"Go to feature\\",\\"targets\\":[{\\"os\\":\\"default\\",\\"uri\\":\\"http://some-url.com/archive\\"}]}]}"`; exports[`Should call teams webhook for archived toggle 1`] = `"{"themeColor":"0076D7","summary":"Message","sections":[{"activityTitle":" some@user.com just archived feature toggle *[some-toggle](http://some-url.com/archive)*","activitySubtitle":"Unleash notification update","facts":[{"name":"User","value":"some@user.com"},{"name":"Action","value":"feature-archived"}]}],"potentialAction":[{"@type":"OpenUri","name":"Go to feature","targets":[{"os":"default","uri":"http://some-url.com/archive"}]}]}"`;
exports[`Should call teams webhook for toggled environment 1`] = `"{\\"themeColor\\":\\"0076D7\\",\\"summary\\":\\"Message\\",\\"sections\\":[{\\"activityTitle\\":\\"some@user.com *disabled* [some-toggle](http://some-url.com/projects/default/some-toggle) in *development* environment in project *default*\\",\\"activitySubtitle\\":\\"Unleash notification update\\",\\"facts\\":[{\\"name\\":\\"User\\",\\"value\\":\\"some@user.com\\"},{\\"name\\":\\"Action\\",\\"value\\":\\"feature-environment-disabled\\"}]}],\\"potentialAction\\":[{\\"@type\\":\\"OpenUri\\",\\"name\\":\\"Go to feature\\",\\"targets\\":[{\\"os\\":\\"default\\",\\"uri\\":\\"http://some-url.com/projects/default/some-toggle\\"}]}]}"`; exports[`Should call teams webhook for toggled environment 1`] = `"{"themeColor":"0076D7","summary":"Message","sections":[{"activityTitle":"some@user.com *disabled* [some-toggle](http://some-url.com/projects/default/some-toggle) in *development* environment in project *default*","activitySubtitle":"Unleash notification update","facts":[{"name":"User","value":"some@user.com"},{"name":"Action","value":"feature-environment-disabled"}]}],"potentialAction":[{"@type":"OpenUri","name":"Go to feature","targets":[{"os":"default","uri":"http://some-url.com/projects/default/some-toggle"}]}]}"`;

View File

@ -29,7 +29,7 @@ test('all schema $id attributes should have the expected format', () => {
test('removeJsonSchemaProps', () => { test('removeJsonSchemaProps', () => {
expect(removeJsonSchemaProps({ a: 'b', $id: 'c', components: {} })) expect(removeJsonSchemaProps({ a: 'b', $id: 'c', components: {} }))
.toMatchInlineSnapshot(` .toMatchInlineSnapshot(`
Object { {
"a": "b", "a": "b",
} }
`); `);

View File

@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`apiTokenSchema empty 1`] = ` exports[`apiTokenSchema empty 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "", "instancePath": "",
"keyword": "required", "keyword": "required",
"message": "must have required property 'username'", "message": "must have required property 'username'",
"params": Object { "params": {
"missingProperty": "username", "missingProperty": "username",
}, },
"schemaPath": "#/required", "schemaPath": "#/required",

View File

@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`changePasswordSchema empty 1`] = ` exports[`changePasswordSchema empty 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "", "instancePath": "",
"keyword": "required", "keyword": "required",
"message": "must have required property 'token'", "message": "must have required property 'token'",
"params": Object { "params": {
"missingProperty": "token", "missingProperty": "token",
}, },
"schemaPath": "#/required", "schemaPath": "#/required",

View File

@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`clientApplicationSchema no fields 1`] = ` exports[`clientApplicationSchema no fields 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "", "instancePath": "",
"keyword": "required", "keyword": "required",
"message": "must have required property 'appName'", "message": "must have required property 'appName'",
"params": Object { "params": {
"missingProperty": "appName", "missingProperty": "appName",
}, },
"schemaPath": "#/required", "schemaPath": "#/required",

View File

@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`clientFeaturesSchema no fields 1`] = ` exports[`clientFeaturesSchema no fields 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "", "instancePath": "",
"keyword": "required", "keyword": "required",
"message": "must have required property 'version'", "message": "must have required property 'version'",
"params": Object { "params": {
"missingProperty": "version", "missingProperty": "version",
}, },
"schemaPath": "#/required", "schemaPath": "#/required",

View File

@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`clientMetricsSchema should fail when required field is missing 1`] = ` exports[`clientMetricsSchema should fail when required field is missing 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "/bucket", "instancePath": "/bucket",
"keyword": "required", "keyword": "required",
"message": "must have required property 'stop'", "message": "must have required property 'stop'",
"params": Object { "params": {
"missingProperty": "stop", "missingProperty": "stop",
}, },
"schemaPath": "#/properties/bucket/required", "schemaPath": "#/properties/bucket/required",

View File

@ -1,14 +1,14 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`constraintSchema invalid operator name 1`] = ` exports[`constraintSchema invalid operator name 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "/operator", "instancePath": "/operator",
"keyword": "enum", "keyword": "enum",
"message": "must be equal to one of the allowed values", "message": "must be equal to one of the allowed values",
"params": Object { "params": {
"allowedValues": Array [ "allowedValues": [
"NOT_IN", "NOT_IN",
"IN", "IN",
"STR_ENDS_WITH", "STR_ENDS_WITH",
@ -34,13 +34,13 @@ Object {
`; `;
exports[`constraintSchema invalid value type 1`] = ` exports[`constraintSchema invalid value type 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "/value", "instancePath": "/value",
"keyword": "type", "keyword": "type",
"message": "must be string", "message": "must be string",
"params": Object { "params": {
"type": "string", "type": "string",
}, },
"schemaPath": "#/properties/value/type", "schemaPath": "#/properties/value/type",

View File

@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`contextFieldSchema empty 1`] = ` exports[`contextFieldSchema empty 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "", "instancePath": "",
"keyword": "required", "keyword": "required",
"message": "must have required property 'name'", "message": "must have required property 'name'",
"params": Object { "params": {
"missingProperty": "name", "missingProperty": "name",
}, },
"schemaPath": "#/required", "schemaPath": "#/required",

View File

@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`emailSchema 1`] = ` exports[`emailSchema 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "", "instancePath": "",
"keyword": "required", "keyword": "required",
"message": "must have required property 'email'", "message": "must have required property 'email'",
"params": Object { "params": {
"missingProperty": "email", "missingProperty": "email",
}, },
"schemaPath": "#/required", "schemaPath": "#/required",

View File

@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`featureEnvironmentSchema empty 1`] = ` exports[`featureEnvironmentSchema empty 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "", "instancePath": "",
"keyword": "required", "keyword": "required",
"message": "must have required property 'name'", "message": "must have required property 'name'",
"params": Object { "params": {
"missingProperty": "name", "missingProperty": "name",
}, },
"schemaPath": "#/required", "schemaPath": "#/required",

View File

@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`featureSchema constraints 1`] = ` exports[`featureSchema constraints 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "/strategies/0/constraints/0", "instancePath": "/strategies/0/constraints/0",
"keyword": "required", "keyword": "required",
"message": "must have required property 'operator'", "message": "must have required property 'operator'",
"params": Object { "params": {
"missingProperty": "operator", "missingProperty": "operator",
}, },
"schemaPath": "#/components/schemas/constraintSchema/required", "schemaPath": "#/components/schemas/constraintSchema/required",
@ -18,13 +18,13 @@ Object {
`; `;
exports[`featureSchema variant override values must be an array 1`] = ` exports[`featureSchema variant override values must be an array 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "/variants/0/overrides/0/values", "instancePath": "/variants/0/overrides/0/values",
"keyword": "type", "keyword": "type",
"message": "must be array", "message": "must be array",
"params": Object { "params": {
"type": "array", "type": "array",
}, },
"schemaPath": "#/components/schemas/overrideSchema/properties/values/type", "schemaPath": "#/components/schemas/overrideSchema/properties/values/type",

View File

@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`featureTypeSchema empty 1`] = ` exports[`featureTypeSchema empty 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "", "instancePath": "",
"keyword": "required", "keyword": "required",
"message": "must have required property 'id'", "message": "must have required property 'id'",
"params": Object { "params": {
"missingProperty": "id", "missingProperty": "id",
}, },
"schemaPath": "#/required", "schemaPath": "#/required",

View File

@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`meSchema empty 1`] = ` exports[`meSchema empty 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "", "instancePath": "",
"keyword": "required", "keyword": "required",
"message": "must have required property 'user'", "message": "must have required property 'user'",
"params": Object { "params": {
"missingProperty": "user", "missingProperty": "user",
}, },
"schemaPath": "#/required", "schemaPath": "#/required",
@ -18,13 +18,13 @@ Object {
`; `;
exports[`meSchema missing permissions 1`] = ` exports[`meSchema missing permissions 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "", "instancePath": "",
"keyword": "required", "keyword": "required",
"message": "must have required property 'permissions'", "message": "must have required property 'permissions'",
"params": Object { "params": {
"missingProperty": "permissions", "missingProperty": "permissions",
}, },
"schemaPath": "#/required", "schemaPath": "#/required",
@ -35,13 +35,13 @@ Object {
`; `;
exports[`meSchema missing splash 1`] = ` exports[`meSchema missing splash 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "", "instancePath": "",
"keyword": "required", "keyword": "required",
"message": "must have required property 'splash'", "message": "must have required property 'splash'",
"params": Object { "params": {
"missingProperty": "splash", "missingProperty": "splash",
}, },
"schemaPath": "#/required", "schemaPath": "#/required",

View File

@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`roleSchema 1`] = ` exports[`roleSchema 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "", "instancePath": "",
"keyword": "required", "keyword": "required",
"message": "must have required property 'id'", "message": "must have required property 'id'",
"params": Object { "params": {
"missingProperty": "id", "missingProperty": "id",
}, },
"schemaPath": "#/required", "schemaPath": "#/required",

View File

@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`setStrategySortOrderSchema missing id 1`] = ` exports[`setStrategySortOrderSchema missing id 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "/0", "instancePath": "/0",
"keyword": "required", "keyword": "required",
"message": "must have required property 'id'", "message": "must have required property 'id'",
"params": Object { "params": {
"missingProperty": "id", "missingProperty": "id",
}, },
"schemaPath": "#/items/required", "schemaPath": "#/items/required",
@ -18,13 +18,13 @@ Object {
`; `;
exports[`setStrategySortOrderSchema missing sortOrder 1`] = ` exports[`setStrategySortOrderSchema missing sortOrder 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "/0", "instancePath": "/0",
"keyword": "required", "keyword": "required",
"message": "must have required property 'sortOrder'", "message": "must have required property 'sortOrder'",
"params": Object { "params": {
"missingProperty": "sortOrder", "missingProperty": "sortOrder",
}, },
"schemaPath": "#/items/required", "schemaPath": "#/items/required",
@ -35,13 +35,13 @@ Object {
`; `;
exports[`setStrategySortOrderSchema no additional parameters 1`] = ` exports[`setStrategySortOrderSchema no additional parameters 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "/1", "instancePath": "/1",
"keyword": "additionalProperties", "keyword": "additionalProperties",
"message": "must NOT have additional properties", "message": "must NOT have additional properties",
"params": Object { "params": {
"additionalProperty": "extra", "additionalProperty": "extra",
}, },
"schemaPath": "#/items/additionalProperties", "schemaPath": "#/items/additionalProperties",
@ -52,13 +52,13 @@ Object {
`; `;
exports[`setStrategySortOrderSchema wrong sortOrder type 1`] = ` exports[`setStrategySortOrderSchema wrong sortOrder type 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "/0/sortOrder", "instancePath": "/0/sortOrder",
"keyword": "type", "keyword": "type",
"message": "must be number", "message": "must be number",
"params": Object { "params": {
"type": "number", "type": "number",
}, },
"schemaPath": "#/items/properties/sortOrder/type", "schemaPath": "#/items/properties/sortOrder/type",

View File

@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`sortOrderSchema invalid value type 1`] = ` exports[`sortOrderSchema invalid value type 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "/a", "instancePath": "/a",
"keyword": "type", "keyword": "type",
"message": "must be number", "message": "must be number",
"params": Object { "params": {
"type": "number", "type": "number",
}, },
"schemaPath": "#/additionalProperties/type", "schemaPath": "#/additionalProperties/type",

View File

@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`strategySchema 1`] = ` exports[`strategySchema 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "", "instancePath": "",
"keyword": "required", "keyword": "required",
"message": "must have required property 'name'", "message": "must have required property 'name'",
"params": Object { "params": {
"missingProperty": "name", "missingProperty": "name",
}, },
"schemaPath": "#/required", "schemaPath": "#/required",

View File

@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`tokenUserSchema 1`] = ` exports[`tokenUserSchema 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "", "instancePath": "",
"keyword": "required", "keyword": "required",
"message": "must have required property 'id'", "message": "must have required property 'id'",
"params": Object { "params": {
"missingProperty": "id", "missingProperty": "id",
}, },
"schemaPath": "#/required", "schemaPath": "#/required",

View File

@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`validatePasswordSchema empty 1`] = ` exports[`validatePasswordSchema empty 1`] = `
Object { {
"errors": Array [ "errors": [
Object { {
"instancePath": "", "instancePath": "",
"keyword": "required", "keyword": "required",
"message": "must have required property 'password'", "message": "must have required property 'password'",
"params": Object { "params": {
"missingProperty": "password", "missingProperty": "password",
}, },
"schemaPath": "#/required", "schemaPath": "#/required",

View File

@ -2,10 +2,10 @@ import { createRequestSchema } from './create-request-schema';
test('createRequestSchema', () => { test('createRequestSchema', () => {
expect(createRequestSchema('schemaName')).toMatchInlineSnapshot(` expect(createRequestSchema('schemaName')).toMatchInlineSnapshot(`
Object { {
"content": Object { "content": {
"application/json": Object { "application/json": {
"schema": Object { "schema": {
"$ref": "#/components/schemas/schemaName", "$ref": "#/components/schemas/schemaName",
}, },
}, },

View File

@ -2,10 +2,10 @@ import { createResponseSchema } from './create-response-schema';
test('createResponseSchema', () => { test('createResponseSchema', () => {
expect(createResponseSchema('schemaName')).toMatchInlineSnapshot(` expect(createResponseSchema('schemaName')).toMatchInlineSnapshot(`
Object { {
"content": Object { "content": {
"application/json": Object { "application/json": {
"schema": Object { "schema": {
"$ref": "#/components/schemas/schemaName", "$ref": "#/components/schemas/schemaName",
}, },
}, },

View File

@ -39,7 +39,7 @@ function flushPromises() {
} }
test('Multiple registrations of same appname and instanceid within same time period should only cause one registration', async () => { test('Multiple registrations of same appname and instanceid within same time period should only cause one registration', async () => {
jest.useFakeTimers('modern'); jest.useFakeTimers();
const appStoreSpy = jest.fn(); const appStoreSpy = jest.fn();
const bulkSpy = jest.fn(); const bulkSpy = jest.fn();
const clientApplicationsStore: any = { const clientApplicationsStore: any = {
@ -88,7 +88,7 @@ test('Multiple registrations of same appname and instanceid within same time per
}); });
test('Multiple unique clients causes multiple registrations', async () => { test('Multiple unique clients causes multiple registrations', async () => {
jest.useFakeTimers('modern'); jest.useFakeTimers();
const appStoreSpy = jest.fn(); const appStoreSpy = jest.fn();
const bulkSpy = jest.fn(); const bulkSpy = jest.fn();
const clientApplicationsStore: any = { const clientApplicationsStore: any = {
@ -139,7 +139,7 @@ test('Multiple unique clients causes multiple registrations', async () => {
jest.useRealTimers(); jest.useRealTimers();
}); });
test('Same client registered outside of dedup interval will be registered twice', async () => { test('Same client registered outside of dedup interval will be registered twice', async () => {
jest.useFakeTimers('modern'); jest.useFakeTimers();
const appStoreSpy = jest.fn(); const appStoreSpy = jest.fn();
const bulkSpy = jest.fn(); const bulkSpy = jest.fn();
const clientApplicationsStore: any = { const clientApplicationsStore: any = {
@ -195,7 +195,7 @@ test('Same client registered outside of dedup interval will be registered twice'
}); });
test('No registrations during a time period will not call stores', async () => { test('No registrations during a time period will not call stores', async () => {
jest.useFakeTimers('modern'); jest.useFakeTimers();
const appStoreSpy = jest.fn(); const appStoreSpy = jest.fn();
const bulkSpy = jest.fn(); const bulkSpy = jest.fn();
const clientApplicationsStore: any = { const clientApplicationsStore: any = {

View File

@ -17,7 +17,7 @@ test('should calculate the correct time in seconds', () => {
}); });
test('timer should track the time', async () => { test('timer should track the time', async () => {
jest.useFakeTimers('modern'); jest.useFakeTimers();
const tt = timer.new(); const tt = timer.new();
let diff; let diff;
timeout(() => { timeout(() => {

View File

@ -39,7 +39,7 @@ test('should register client', async () => {
test('should allow client to register multiple times', async () => { test('should allow client to register multiple times', async () => {
expect.assertions(2); expect.assertions(2);
jest.useFakeTimers('modern'); jest.useFakeTimers();
const { clientInstanceStore, clientApplicationsStore } = db.stores; const { clientInstanceStore, clientApplicationsStore } = db.stores;
const clientRegistration = { const clientRegistration = {

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@ afterAll(async () => {
} }
}); });
test('Should include id and createdAt when saving', async () => { test('Should include id and createdAt when saving', async () => {
jest.useFakeTimers('modern'); jest.useFakeTimers();
const event1 = { const event1 = {
type: APPLICATION_CREATED, type: APPLICATION_CREATED,
createdBy: '127.0.0.1', createdBy: '127.0.0.1',
@ -79,7 +79,7 @@ test('Should include empty tags array for new event', async () => {
}); });
test('Should be able to store multiple events at once', async () => { test('Should be able to store multiple events at once', async () => {
jest.useFakeTimers('modern'); jest.useFakeTimers();
const event1 = { const event1 = {
type: APPLICATION_CREATED, type: APPLICATION_CREATED,
createdBy: '127.0.0.1', createdBy: '127.0.0.1',

1507
yarn.lock

File diff suppressed because it is too large Load Diff