Compare commits
2 Commits
b49dfe3187
...
e1364b49e8
Author | SHA1 | Date | |
---|---|---|---|
|
e1364b49e8 | ||
|
31c0cd6662 |
@ -1,5 +0,0 @@
|
||||
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
|
||||
module.exports = {
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
};
|
2
makefile
2
makefile
@ -19,7 +19,7 @@ build-sass:
|
||||
build: lint build-tsc build-sass
|
||||
|
||||
test:
|
||||
node ./node_modules/ts-jest/cli.js
|
||||
npx jest --config src/jest.config.js
|
||||
|
||||
move:
|
||||
mkdir -p ./dist/client/webapp/font
|
||||
|
231
package-lock.json
generated
231
package-lock.json
generated
@ -30,6 +30,7 @@
|
||||
"source-map": "^0.7.3",
|
||||
"sqlite": "^4.0.23",
|
||||
"sqlite3": "^5.1.2",
|
||||
"ts-node": "^10.9.1",
|
||||
"tsee": "^1.3.2",
|
||||
"uuid": "^9.0.0"
|
||||
},
|
||||
@ -656,6 +657,26 @@
|
||||
"integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@cspotcode/source-map-support": {
|
||||
"version": "0.8.1",
|
||||
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
|
||||
"integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
|
||||
"dependencies": {
|
||||
"@jridgewell/trace-mapping": "0.3.9"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": {
|
||||
"version": "0.3.9",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
|
||||
"integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
|
||||
"dependencies": {
|
||||
"@jridgewell/resolve-uri": "^3.0.3",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@electron/get": {
|
||||
"version": "1.14.1",
|
||||
"resolved": "https://registry.npmjs.org/@electron/get/-/get-1.14.1.tgz",
|
||||
@ -1170,7 +1191,6 @@
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz",
|
||||
"integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
@ -1187,8 +1207,7 @@
|
||||
"node_modules/@jridgewell/sourcemap-codec": {
|
||||
"version": "1.4.14",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
|
||||
"integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw=="
|
||||
},
|
||||
"node_modules/@jridgewell/trace-mapping": {
|
||||
"version": "0.3.15",
|
||||
@ -1336,6 +1355,26 @@
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/@tsconfig/node10": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz",
|
||||
"integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA=="
|
||||
},
|
||||
"node_modules/@tsconfig/node12": {
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
|
||||
"integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag=="
|
||||
},
|
||||
"node_modules/@tsconfig/node14": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
|
||||
"integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow=="
|
||||
},
|
||||
"node_modules/@tsconfig/node16": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz",
|
||||
"integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ=="
|
||||
},
|
||||
"node_modules/@types/babel__core": {
|
||||
"version": "7.1.19",
|
||||
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.19.tgz",
|
||||
@ -1751,6 +1790,14 @@
|
||||
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/acorn-walk": {
|
||||
"version": "8.2.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
|
||||
"integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/agent-base": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
|
||||
@ -1882,6 +1929,11 @@
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/arg": {
|
||||
"version": "4.1.3",
|
||||
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
|
||||
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA=="
|
||||
},
|
||||
"node_modules/argparse": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
||||
@ -2540,6 +2592,11 @@
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/create-require": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
|
||||
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ=="
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||
@ -2671,6 +2728,14 @@
|
||||
"integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/diff": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
|
||||
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
|
||||
"engines": {
|
||||
"node": ">=0.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/diff-sequences": {
|
||||
"version": "29.0.0",
|
||||
"resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.0.0.tgz",
|
||||
@ -5228,8 +5293,7 @@
|
||||
"node_modules/make-error": {
|
||||
"version": "1.3.6",
|
||||
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
|
||||
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw=="
|
||||
},
|
||||
"node_modules/make-fetch-happen": {
|
||||
"version": "9.1.0",
|
||||
@ -7477,6 +7541,48 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/ts-node": {
|
||||
"version": "10.9.1",
|
||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
|
||||
"integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==",
|
||||
"dependencies": {
|
||||
"@cspotcode/source-map-support": "^0.8.0",
|
||||
"@tsconfig/node10": "^1.0.7",
|
||||
"@tsconfig/node12": "^1.0.7",
|
||||
"@tsconfig/node14": "^1.0.0",
|
||||
"@tsconfig/node16": "^1.0.2",
|
||||
"acorn": "^8.4.1",
|
||||
"acorn-walk": "^8.1.1",
|
||||
"arg": "^4.1.0",
|
||||
"create-require": "^1.1.0",
|
||||
"diff": "^4.0.1",
|
||||
"make-error": "^1.1.1",
|
||||
"v8-compile-cache-lib": "^3.0.1",
|
||||
"yn": "3.1.1"
|
||||
},
|
||||
"bin": {
|
||||
"ts-node": "dist/bin.js",
|
||||
"ts-node-cwd": "dist/bin-cwd.js",
|
||||
"ts-node-esm": "dist/bin-esm.js",
|
||||
"ts-node-script": "dist/bin-script.js",
|
||||
"ts-node-transpile-only": "dist/bin-transpile.js",
|
||||
"ts-script": "dist/bin-script-deprecated.js"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@swc/core": ">=1.2.50",
|
||||
"@swc/wasm": ">=1.2.50",
|
||||
"@types/node": "*",
|
||||
"typescript": ">=2.7"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@swc/core": {
|
||||
"optional": true
|
||||
},
|
||||
"@swc/wasm": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/tsee": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/tsee/-/tsee-1.3.2.tgz",
|
||||
@ -7566,7 +7672,6 @@
|
||||
"version": "4.8.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
|
||||
"integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
@ -7674,6 +7779,11 @@
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/v8-compile-cache-lib": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
|
||||
"integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg=="
|
||||
},
|
||||
"node_modules/v8-to-istanbul": {
|
||||
"version": "9.0.1",
|
||||
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.0.1.tgz",
|
||||
@ -7866,6 +7976,14 @@
|
||||
"fd-slicer": "~1.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/yn": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
|
||||
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/yocto-queue": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
|
||||
@ -8337,6 +8455,25 @@
|
||||
"integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==",
|
||||
"dev": true
|
||||
},
|
||||
"@cspotcode/source-map-support": {
|
||||
"version": "0.8.1",
|
||||
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
|
||||
"integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
|
||||
"requires": {
|
||||
"@jridgewell/trace-mapping": "0.3.9"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jridgewell/trace-mapping": {
|
||||
"version": "0.3.9",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
|
||||
"integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
|
||||
"requires": {
|
||||
"@jridgewell/resolve-uri": "^3.0.3",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@electron/get": {
|
||||
"version": "1.14.1",
|
||||
"resolved": "https://registry.npmjs.org/@electron/get/-/get-1.14.1.tgz",
|
||||
@ -8736,8 +8873,7 @@
|
||||
"@jridgewell/resolve-uri": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz",
|
||||
"integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==",
|
||||
"dev": true
|
||||
"integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w=="
|
||||
},
|
||||
"@jridgewell/set-array": {
|
||||
"version": "1.1.2",
|
||||
@ -8748,8 +8884,7 @@
|
||||
"@jridgewell/sourcemap-codec": {
|
||||
"version": "1.4.14",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
|
||||
"integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw=="
|
||||
},
|
||||
"@jridgewell/trace-mapping": {
|
||||
"version": "0.3.15",
|
||||
@ -8873,6 +9008,26 @@
|
||||
"integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==",
|
||||
"optional": true
|
||||
},
|
||||
"@tsconfig/node10": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz",
|
||||
"integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA=="
|
||||
},
|
||||
"@tsconfig/node12": {
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
|
||||
"integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag=="
|
||||
},
|
||||
"@tsconfig/node14": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
|
||||
"integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow=="
|
||||
},
|
||||
"@tsconfig/node16": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz",
|
||||
"integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ=="
|
||||
},
|
||||
"@types/babel__core": {
|
||||
"version": "7.1.19",
|
||||
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.19.tgz",
|
||||
@ -9188,6 +9343,11 @@
|
||||
"integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
|
||||
"requires": {}
|
||||
},
|
||||
"acorn-walk": {
|
||||
"version": "8.2.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
|
||||
"integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA=="
|
||||
},
|
||||
"agent-base": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
|
||||
@ -9281,6 +9441,11 @@
|
||||
"readable-stream": "^3.6.0"
|
||||
}
|
||||
},
|
||||
"arg": {
|
||||
"version": "4.1.3",
|
||||
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
|
||||
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA=="
|
||||
},
|
||||
"argparse": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
||||
@ -9754,6 +9919,11 @@
|
||||
"vary": "^1"
|
||||
}
|
||||
},
|
||||
"create-require": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
|
||||
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ=="
|
||||
},
|
||||
"cross-spawn": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||
@ -9850,6 +10020,11 @@
|
||||
"integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==",
|
||||
"optional": true
|
||||
},
|
||||
"diff": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
|
||||
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A=="
|
||||
},
|
||||
"diff-sequences": {
|
||||
"version": "29.0.0",
|
||||
"resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.0.0.tgz",
|
||||
@ -11739,8 +11914,7 @@
|
||||
"make-error": {
|
||||
"version": "1.3.6",
|
||||
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
|
||||
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw=="
|
||||
},
|
||||
"make-fetch-happen": {
|
||||
"version": "9.1.0",
|
||||
@ -13344,6 +13518,26 @@
|
||||
"yargs-parser": "^21.0.1"
|
||||
}
|
||||
},
|
||||
"ts-node": {
|
||||
"version": "10.9.1",
|
||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
|
||||
"integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==",
|
||||
"requires": {
|
||||
"@cspotcode/source-map-support": "^0.8.0",
|
||||
"@tsconfig/node10": "^1.0.7",
|
||||
"@tsconfig/node12": "^1.0.7",
|
||||
"@tsconfig/node14": "^1.0.0",
|
||||
"@tsconfig/node16": "^1.0.2",
|
||||
"acorn": "^8.4.1",
|
||||
"acorn-walk": "^8.1.1",
|
||||
"arg": "^4.1.0",
|
||||
"create-require": "^1.1.0",
|
||||
"diff": "^4.0.1",
|
||||
"make-error": "^1.1.1",
|
||||
"v8-compile-cache-lib": "^3.0.1",
|
||||
"yn": "3.1.1"
|
||||
}
|
||||
},
|
||||
"tsee": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/tsee/-/tsee-1.3.2.tgz",
|
||||
@ -13410,8 +13604,7 @@
|
||||
"typescript": {
|
||||
"version": "4.8.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
|
||||
"integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
|
||||
"dev": true
|
||||
"integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ=="
|
||||
},
|
||||
"unbox-primitive": {
|
||||
"version": "1.0.2",
|
||||
@ -13484,6 +13677,11 @@
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz",
|
||||
"integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg=="
|
||||
},
|
||||
"v8-compile-cache-lib": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
|
||||
"integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg=="
|
||||
},
|
||||
"v8-to-istanbul": {
|
||||
"version": "9.0.1",
|
||||
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.0.1.tgz",
|
||||
@ -13634,6 +13832,11 @@
|
||||
"fd-slicer": "~1.1.0"
|
||||
}
|
||||
},
|
||||
"yn": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
|
||||
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q=="
|
||||
},
|
||||
"yocto-queue": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
|
||||
|
@ -27,6 +27,7 @@
|
||||
"source-map": "^0.7.3",
|
||||
"sqlite": "^4.0.23",
|
||||
"sqlite3": "^5.1.2",
|
||||
"ts-node": "^10.9.1",
|
||||
"tsee": "^1.3.2",
|
||||
"uuid": "^9.0.0"
|
||||
},
|
||||
|
@ -0,0 +1,282 @@
|
||||
import { AutoVerifier } from '../../webapp/auto-verifier';
|
||||
import { WithEquals } from '../../webapp/data-types';
|
||||
import Util from '../../webapp/util';
|
||||
|
||||
jest.mock('@electron/remote', () => ({ getGlobal: jest.fn() }));
|
||||
|
||||
class BasicWE implements WithEquals<BasicWE> {
|
||||
static fromIds(ids: number[]): BasicWE[] {
|
||||
return ids.map(id => new BasicWE(id));
|
||||
}
|
||||
|
||||
static fromCombos(combos: { id: string | number, extra: string | null }[]): BasicWE[] {
|
||||
return combos.map(({ id, extra }) => new BasicWE(id, extra));
|
||||
}
|
||||
|
||||
id: string;
|
||||
constructor(public id_: string | number, public readonly extra: string | null = null) { this.id = id_ + '' }
|
||||
|
||||
equals(other: BasicWE) {
|
||||
return this.id == other.id && this.extra == other.extra;
|
||||
}
|
||||
}
|
||||
|
||||
describe('getChanges tests', () => {
|
||||
test('both null', () => {
|
||||
const primary = null;
|
||||
const trusted = null;
|
||||
const changes = AutoVerifier.getChanges(primary, trusted);
|
||||
expect(changes).toEqual({
|
||||
added: [],
|
||||
updated: [],
|
||||
deleted: [],
|
||||
});
|
||||
});
|
||||
|
||||
test('null primary gives trusted as added', () => {
|
||||
const primary = null;
|
||||
const trusted = BasicWE.fromIds([2, 3, 4]);
|
||||
const changes = AutoVerifier.getChanges(primary, trusted);
|
||||
expect(changes).toEqual({
|
||||
added: BasicWE.fromIds([2, 3, 4]),
|
||||
updated: [],
|
||||
deleted: [],
|
||||
});
|
||||
});
|
||||
|
||||
test('null trusted gives primary as deleted', () => {
|
||||
const primary = BasicWE.fromIds([2, 3, 4]);
|
||||
const trusted = null;
|
||||
const changes = AutoVerifier.getChanges(primary, trusted);
|
||||
expect(changes).toEqual({
|
||||
added: [],
|
||||
updated: [],
|
||||
deleted: BasicWE.fromIds([2, 3, 4]),
|
||||
});
|
||||
});
|
||||
|
||||
test('equal', () => {
|
||||
const primary = BasicWE.fromIds([2, 3, 4]);
|
||||
const trusted = BasicWE.fromIds([2, 3, 4]);
|
||||
const changes = AutoVerifier.getChanges(primary, trusted);
|
||||
expect(changes).toEqual({
|
||||
added: [],
|
||||
updated: [],
|
||||
deleted: [],
|
||||
});
|
||||
});
|
||||
|
||||
test('added', () => {
|
||||
const primary = BasicWE.fromIds([2, 3, 4]);
|
||||
const trusted = BasicWE.fromIds([2, 3, 4, 5, 6]);
|
||||
const changes = AutoVerifier.getChanges(primary, trusted);
|
||||
expect(changes).toEqual({
|
||||
added: BasicWE.fromIds([5, 6]),
|
||||
updated: [],
|
||||
deleted: [],
|
||||
});
|
||||
});
|
||||
|
||||
test('changed', () => {
|
||||
const primary = BasicWE.fromCombos([ { id: 2, extra: 'a' }, { id: 3, extra: 'b' }, { id: 4, extra: 'c' }, { id: 5, extra: 'd' } ]);
|
||||
const trusted = BasicWE.fromCombos([ { id: 2, extra: '*' }, { id: 3, extra: 'b' }, { id: 4, extra: '*' }, { id: 5, extra: 'd' } ]);
|
||||
const changes = AutoVerifier.getChanges(primary, trusted);
|
||||
expect(changes).toEqual({
|
||||
added: [],
|
||||
updated: [
|
||||
{ oldDataPoint: new BasicWE(2, 'a'), newDataPoint: new BasicWE(2, '*') },
|
||||
{ oldDataPoint: new BasicWE(4, 'c'), newDataPoint: new BasicWE(4, '*') },
|
||||
],
|
||||
deleted: [],
|
||||
});
|
||||
});
|
||||
|
||||
test('deleted', () => {
|
||||
const primary = BasicWE.fromIds([2, 3, 4]);
|
||||
const trusted = BasicWE.fromIds([2]);
|
||||
const changes = AutoVerifier.getChanges(primary, trusted);
|
||||
expect(changes).toEqual({
|
||||
added: [],
|
||||
updated: [],
|
||||
deleted: BasicWE.fromIds([3, 4]),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('constructor/factory tests', () => {
|
||||
test('constructor', () => {
|
||||
const av = new AutoVerifier(jest.fn(), jest.fn(), jest.fn(), jest.fn());
|
||||
expect(av.primaryPromise).toBe(null);
|
||||
expect(av.trustedPromise).toBe(null);
|
||||
expect(av.trustedStatus).toBe('none')
|
||||
});
|
||||
|
||||
test('createStandardListAutoVerifier', () => {
|
||||
const av = AutoVerifier.createStandardListAutoVerifier(jest.fn(), jest.fn(), jest.fn(), jest.fn());
|
||||
expect(av.primaryPromise).toBe(null);
|
||||
expect(av.trustedPromise).toBe(null);
|
||||
expect(av.trustedStatus).toBe('none')
|
||||
});
|
||||
|
||||
test('createStandardSingleAutoVerifier', () => {
|
||||
const av = AutoVerifier.createStandardListAutoVerifier(jest.fn(), jest.fn(), jest.fn(), jest.fn());
|
||||
expect(av.primaryPromise).toBe(null);
|
||||
expect(av.trustedPromise).toBe(null);
|
||||
expect(av.trustedStatus).toBe('none')
|
||||
});
|
||||
});
|
||||
|
||||
describe('fetchAndVerifyIfNeeded tests', () => {
|
||||
class ManualPromise<T> {
|
||||
promise: Promise<T>;
|
||||
resolve: (value: T) => void;
|
||||
reject: (reason?: any) => void;
|
||||
|
||||
constructor() {
|
||||
this.resolve = undefined as unknown as (value: T) => void;
|
||||
this.reject = undefined as unknown as (reason?: any) => void;
|
||||
this.promise = new Promise<T>((resolve, reject) => {
|
||||
this.resolve = resolve;
|
||||
this.reject = reject;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getManualsAndMocks(): {
|
||||
nextPrimary: () => ManualPromise<BasicWE | null>,
|
||||
nextTrusted: () => ManualPromise<BasicWE | null>,
|
||||
nextEnsureTrustedFuncReady: () => ManualPromise<void>,
|
||||
nextVerify: () => ManualPromise<boolean>,
|
||||
primaryFunc: jest.Mock<Promise<BasicWE | null>, []>,
|
||||
trustedFunc: jest.Mock<Promise<BasicWE | null>, []>,
|
||||
ensureTrustedFuncReadyFunc: jest.Mock<Promise<void>, []>,
|
||||
verifyFunc: jest.Mock<Promise<boolean>, []>,
|
||||
} {
|
||||
const manuals: {
|
||||
primary: ManualPromise<BasicWE | null>[],
|
||||
trusted: ManualPromise<BasicWE | null>[],
|
||||
ensureTrustedFuncReady: ManualPromise<void>[],
|
||||
verify: ManualPromise<boolean>[],
|
||||
} = {
|
||||
primary: [],
|
||||
trusted: [],
|
||||
ensureTrustedFuncReady: [],
|
||||
verify: [],
|
||||
};
|
||||
|
||||
const calls: {
|
||||
primary: number,
|
||||
trusted: number,
|
||||
ensureTrustedFuncReady: number,
|
||||
verify: number,
|
||||
} = {
|
||||
primary: 0,
|
||||
trusted: 0,
|
||||
ensureTrustedFuncReady: 0,
|
||||
verify: 0
|
||||
};
|
||||
|
||||
function getNext<T>(manualList: ManualPromise<T>[]) {
|
||||
const next = new ManualPromise<T>();
|
||||
manualList.push(next);
|
||||
return next;
|
||||
}
|
||||
|
||||
return {
|
||||
nextPrimary: () => getNext(manuals.primary),
|
||||
nextTrusted: () => getNext(manuals.trusted),
|
||||
nextEnsureTrustedFuncReady: () => getNext(manuals.ensureTrustedFuncReady),
|
||||
nextVerify: () => getNext(manuals.verify),
|
||||
primaryFunc: jest.fn(() => manuals.primary[calls.primary++]!.promise),
|
||||
trustedFunc: jest.fn(() => manuals.trusted[calls.trusted++]!.promise),
|
||||
ensureTrustedFuncReadyFunc: jest.fn(() => manuals.ensureTrustedFuncReady[calls.ensureTrustedFuncReady++]!.promise),
|
||||
verifyFunc: jest.fn(() => manuals.verify[calls.verify++]!.promise),
|
||||
}
|
||||
}
|
||||
function getGeneralMocks(): {
|
||||
primary: ManualPromise<BasicWE>,
|
||||
trusted: ManualPromise<BasicWE>,
|
||||
ensureTrustedFuncReady: ManualPromise<void>,
|
||||
verify: ManualPromise<boolean>
|
||||
primaryFunc: () => Promise<BasicWE>,
|
||||
trustedFunc: () => Promise<BasicWE>,
|
||||
ensureTrustedFuncReadyFunc: () => Promise<void>,
|
||||
verifyFunc: () => Promise<boolean>,
|
||||
} {
|
||||
const primary = new ManualPromise<BasicWE>();
|
||||
const trusted = new ManualPromise<BasicWE>();
|
||||
const ensureTrustedFuncReady = new ManualPromise<void>();
|
||||
const verify = new ManualPromise<boolean>();
|
||||
return {
|
||||
primary,
|
||||
trusted,
|
||||
ensureTrustedFuncReady,
|
||||
verify,
|
||||
primaryFunc: () => primary.promise,
|
||||
trustedFunc: () => trusted.promise,
|
||||
ensureTrustedFuncReadyFunc: () => ensureTrustedFuncReady.promise,
|
||||
verifyFunc: () => verify.promise,
|
||||
};
|
||||
}
|
||||
async function disjoint() {
|
||||
await Util.sleep(0);
|
||||
}
|
||||
test('nothing before, primary with value, then trusted with value', async () => {
|
||||
// TODO: Make xxxFunc mock functions that can be tested for if they were called
|
||||
const {
|
||||
nextPrimary, nextTrusted, nextEnsureTrustedFuncReady, nextVerify,
|
||||
primaryFunc, trustedFunc, ensureTrustedFuncReadyFunc, verifyFunc
|
||||
} = getManualsAndMocks();
|
||||
|
||||
const primary = nextPrimary();
|
||||
const trusted = nextTrusted();
|
||||
const ensureTrustedFuncReady = nextEnsureTrustedFuncReady();
|
||||
const verify = nextVerify();
|
||||
|
||||
const av = new AutoVerifier(primaryFunc, trustedFunc, ensureTrustedFuncReadyFunc, verifyFunc);
|
||||
const result = av.fetchAndVerifyIfNeeded();
|
||||
|
||||
expect(av.primaryPromise).toBe(primary.promise);
|
||||
expect(av.trustedPromise).toBe(trusted.promise);
|
||||
expect(av.trustedStatus).toBe('fetching');
|
||||
|
||||
primary.resolve(new BasicWE(2));
|
||||
await disjoint();
|
||||
|
||||
expect(primaryFunc).toHaveBeenCalled();
|
||||
expect(result).resolves.toEqual(new BasicWE(2));
|
||||
expect(av.primaryPromise).toBe(null);
|
||||
expect(av.trustedPromise).toBe(trusted.promise);
|
||||
expect(av.trustedStatus).toBe('verifying');
|
||||
|
||||
ensureTrustedFuncReady.resolve();
|
||||
await disjoint();
|
||||
|
||||
expect(ensureTrustedFuncReadyFunc).toHaveBeenCalled();
|
||||
expect(av.primaryPromise).toBe(null);
|
||||
expect(av.trustedPromise).toBe(trusted.promise);
|
||||
expect(av.trustedStatus).toBe('verifying');
|
||||
|
||||
trusted.resolve(new BasicWE(2));
|
||||
await disjoint();
|
||||
|
||||
expect(trustedFunc).toHaveBeenCalled();
|
||||
expect(av.primaryPromise).toBe(null);
|
||||
expect(av.trustedPromise).toBe(trusted.promise);
|
||||
expect(av.trustedStatus).toBe('verifying');
|
||||
|
||||
verify.resolve(true);
|
||||
await disjoint();
|
||||
|
||||
expect(verifyFunc).toHaveBeenCalled();
|
||||
expect(av.primaryPromise).toBe(null);
|
||||
expect(av.trustedPromise).toBe(trusted.promise);
|
||||
expect(av.trustedStatus).toBe('verified');
|
||||
|
||||
expect(primaryFunc).toHaveBeenCalledTimes(1);
|
||||
expect(trustedFunc).toHaveBeenCalledTimes(1);
|
||||
expect(ensureTrustedFuncReadyFunc).toHaveBeenCalledTimes(1);
|
||||
expect(verifyFunc).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
// Make sure to do try/catch errors
|
||||
});
|
12
src/jest.config.ts
Normal file
12
src/jest.config.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import type { Config } from 'jest';
|
||||
|
||||
const config: Config = {
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
coverageDirectory: './coverage',
|
||||
collectCoverage: true,
|
||||
testPathIgnorePatterns: [ '/^node_modules$/', '/^archive$/' ],
|
||||
};
|
||||
|
||||
export default config;
|
||||
|
Loading…
Reference in New Issue
Block a user