diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cd06272d937f09989f48cacde2eb67761be9c214..b14587cde6c56a5749d5082d741a619704e006d1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,17 +16,6 @@ workflow: # Pipeline start # ============================================================================= -# Run the unit tests -testing: - image: node:22-alpine - stage: validate - rules: - - changes: - - src/**/* - script: - - npm ci - - npm test - # Validate the fasta files if they have changed validate-fasta-files: image: node:22-alpine diff --git a/package-lock.json b/package-lock.json index 7b789b2a249c7ec5d60c55fd54a3c6c43281fa32..d8ca428b5e9cef3587ce14a4dce059676341825d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,7 +37,6 @@ "rollup-plugin-gzip": "^4.0.1", "typescript": "^5.7.3", "vite": "^6.1.0", - "vitest": "^3.0.5", "vue-tsc": "^2.2.0" } }, @@ -1253,129 +1252,6 @@ "vue": "^3.2.25" } }, - "node_modules/@vitest/expect": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-3.0.5.tgz", - "integrity": "sha512-nNIOqupgZ4v5jWuQx2DSlHLEs7Q4Oh/7AYwNyE+k0UQzG7tSmjPXShUikn1mpNGzYEN2jJbTvLejwShMitovBA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/spy": "3.0.5", - "@vitest/utils": "3.0.5", - "chai": "^5.1.2", - "tinyrainbow": "^2.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/mocker": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-3.0.5.tgz", - "integrity": "sha512-CLPNBFBIE7x6aEGbIjaQAX03ZZlBMaWwAjBdMkIf/cAn6xzLTiM3zYqO/WAbieEjsAZir6tO71mzeHZoodThvw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/spy": "3.0.5", - "estree-walker": "^3.0.3", - "magic-string": "^0.30.17" - }, - "funding": { - "url": "https://opencollective.com/vitest" - }, - "peerDependencies": { - "msw": "^2.4.9", - "vite": "^5.0.0 || ^6.0.0" - }, - "peerDependenciesMeta": { - "msw": { - "optional": true - }, - "vite": { - "optional": true - } - } - }, - "node_modules/@vitest/mocker/node_modules/estree-walker": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", - "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0" - } - }, - "node_modules/@vitest/pretty-format": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-3.0.5.tgz", - "integrity": "sha512-CjUtdmpOcm4RVtB+up8r2vVDLR16Mgm/bYdkGFe3Yj/scRfCpbSi2W/BDSDcFK7ohw8UXvjMbOp9H4fByd/cOA==", - "dev": true, - "license": "MIT", - "dependencies": { - "tinyrainbow": "^2.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/runner": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-3.0.5.tgz", - "integrity": "sha512-BAiZFityFexZQi2yN4OX3OkJC6scwRo8EhRB0Z5HIGGgd2q+Nq29LgHU/+ovCtd0fOfXj5ZI6pwdlUmC5bpi8A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/utils": "3.0.5", - "pathe": "^2.0.2" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/snapshot": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-3.0.5.tgz", - "integrity": "sha512-GJPZYcd7v8QNUJ7vRvLDmRwl+a1fGg4T/54lZXe+UOGy47F9yUfE18hRCtXL5aHN/AONu29NGzIXSVFh9K0feA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/pretty-format": "3.0.5", - "magic-string": "^0.30.17", - "pathe": "^2.0.2" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/spy": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-3.0.5.tgz", - "integrity": "sha512-5fOzHj0WbUNqPK6blI/8VzZdkBlQLnT25knX0r4dbZI9qoZDf3qAdjoMmDcLG5A83W6oUUFJgUd0EYBc2P5xqg==", - "dev": true, - "license": "MIT", - "dependencies": { - "tinyspy": "^3.0.2" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/utils": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-3.0.5.tgz", - "integrity": "sha512-N9AX0NUoUtVwKwy21JtwzaqR5L5R5A99GAbrHfCCXK1lp593i/3AZAXhSP43wRQuxYsflrdzEfXZFo1reR1Nkg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/pretty-format": "3.0.5", - "loupe": "^3.1.2", - "tinyrainbow": "^2.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, "node_modules/@volar/language-core": { "version": "2.4.11", "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.4.11.tgz", @@ -1692,16 +1568,6 @@ "node": ">= 8" } }, - "node_modules/assertion-error": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", - "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - } - }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -1907,16 +1773,6 @@ "ieee754": "^1.2.1" } }, - "node_modules/cac": { - "version": "6.7.14", - "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", - "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/call-bind-apply-helpers": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.1.tgz", @@ -1979,23 +1835,6 @@ ], "license": "CC-BY-4.0" }, - "node_modules/chai": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/chai/-/chai-5.1.2.tgz", - "integrity": "sha512-aGtmf24DW6MLHHG5gCx4zaI3uBq3KRtxeVs0DjFH6Z0rDNbsvTxFASFvdj79pxjxZ8/5u3PIiN3IwEIQkiiuPw==", - "dev": true, - "license": "MIT", - "dependencies": { - "assertion-error": "^2.0.1", - "check-error": "^2.1.1", - "deep-eql": "^5.0.1", - "loupe": "^3.1.0", - "pathval": "^2.0.0" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -2024,16 +1863,6 @@ "node": ">=8" } }, - "node_modules/check-error": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.1.tgz", - "integrity": "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 16" - } - }, "node_modules/chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", @@ -2429,16 +2258,6 @@ } } }, - "node_modules/deep-eql": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", - "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -2620,13 +2439,6 @@ "node": ">= 0.4" } }, - "node_modules/es-module-lexer": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.6.0.tgz", - "integrity": "sha512-qqnD1yMU6tk/jnaMosogGySTZP8YtUgAffA9nMN+E/rjxcfRQ6IEk7IiozUjgxKoFHBGjTLnrHB/YC45r/59EQ==", - "dev": true, - "license": "MIT" - }, "node_modules/es-object-atoms": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", @@ -2717,16 +2529,6 @@ "node": ">=0.8.x" } }, - "node_modules/expect-type": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.1.0.tgz", - "integrity": "sha512-bFi65yM+xZgk+u/KRIpekdSYkTB5W1pEf0Lt8Q8Msh7b+eQ7LXVtIB1Bkm4fvclDEL1b2CZkMhv2mOeF8tMdkA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=12.0.0" - } - }, "node_modules/fast-copy": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/fast-copy/-/fast-copy-3.0.2.tgz", @@ -3328,13 +3130,6 @@ "integrity": "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==", "dev": true }, - "node_modules/loupe": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.1.3.tgz", - "integrity": "sha512-kkIp7XSkP78ZxJEsSxW3712C6teJVoeHHwgo9zJ380de7IYyJ2ISlxojcH2pC5OFLewESmnRi/+XCDIEEVyoug==", - "dev": true, - "license": "MIT" - }, "node_modules/lru-cache": { "version": "11.0.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.1.tgz", @@ -3706,23 +3501,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/pathe": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", - "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", - "dev": true, - "license": "MIT" - }, - "node_modules/pathval": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.0.tgz", - "integrity": "sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 14.16" - } - }, "node_modules/perfect-debounce": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/perfect-debounce/-/perfect-debounce-1.0.0.tgz", @@ -4689,13 +4467,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/siginfo": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", - "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", - "dev": true, - "license": "ISC" - }, "node_modules/signal-exit": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", @@ -4763,13 +4534,6 @@ "node": ">= 10.x" } }, - "node_modules/stackback": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", - "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", - "dev": true, - "license": "MIT" - }, "node_modules/statuses": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", @@ -4779,13 +4543,6 @@ "node": ">= 0.8" } }, - "node_modules/std-env": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.8.0.tgz", - "integrity": "sha512-Bc3YwwCB+OzldMxOXJIIvC6cPRWr/LxOp48CdQTOkPyk/t4JWWJbrilwBd7RJzKV8QW7tJkcgAmeuLLJugl5/w==", - "dev": true, - "license": "MIT" - }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -4934,50 +4691,6 @@ "real-require": "^0.2.0" } }, - "node_modules/tinybench": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", - "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", - "dev": true, - "license": "MIT" - }, - "node_modules/tinyexec": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", - "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==", - "dev": true, - "license": "MIT" - }, - "node_modules/tinypool": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.0.2.tgz", - "integrity": "sha512-al6n+QEANGFOMf/dmUMsuS5/r9B06uwlyNjZZql/zv8J7ybHCgoihBNORZCY2mzUuAnomQa2JdhyHKzZxPCrFA==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^18.0.0 || >=20.0.0" - } - }, - "node_modules/tinyrainbow": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-2.0.0.tgz", - "integrity": "sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/tinyspy": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-3.0.2.tgz", - "integrity": "sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -5189,99 +4902,6 @@ } } }, - "node_modules/vite-node": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-3.0.5.tgz", - "integrity": "sha512-02JEJl7SbtwSDJdYS537nU6l+ktdvcREfLksk/NDAqtdKWGqHl+joXzEubHROmS3E6pip+Xgu2tFezMu75jH7A==", - "dev": true, - "license": "MIT", - "dependencies": { - "cac": "^6.7.14", - "debug": "^4.4.0", - "es-module-lexer": "^1.6.0", - "pathe": "^2.0.2", - "vite": "^5.0.0 || ^6.0.0" - }, - "bin": { - "vite-node": "vite-node.mjs" - }, - "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/vitest": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-3.0.5.tgz", - "integrity": "sha512-4dof+HvqONw9bvsYxtkfUp2uHsTN9bV2CZIi1pWgoFpL1Lld8LA1ka9q/ONSsoScAKG7NVGf2stJTI7XRkXb2Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/expect": "3.0.5", - "@vitest/mocker": "3.0.5", - "@vitest/pretty-format": "^3.0.5", - "@vitest/runner": "3.0.5", - "@vitest/snapshot": "3.0.5", - "@vitest/spy": "3.0.5", - "@vitest/utils": "3.0.5", - "chai": "^5.1.2", - "debug": "^4.4.0", - "expect-type": "^1.1.0", - "magic-string": "^0.30.17", - "pathe": "^2.0.2", - "std-env": "^3.8.0", - "tinybench": "^2.9.0", - "tinyexec": "^0.3.2", - "tinypool": "^1.0.2", - "tinyrainbow": "^2.0.0", - "vite": "^5.0.0 || ^6.0.0", - "vite-node": "3.0.5", - "why-is-node-running": "^2.3.0" - }, - "bin": { - "vitest": "vitest.mjs" - }, - "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - }, - "peerDependencies": { - "@edge-runtime/vm": "*", - "@types/debug": "^4.1.12", - "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", - "@vitest/browser": "3.0.5", - "@vitest/ui": "3.0.5", - "happy-dom": "*", - "jsdom": "*" - }, - "peerDependenciesMeta": { - "@edge-runtime/vm": { - "optional": true - }, - "@types/debug": { - "optional": true - }, - "@types/node": { - "optional": true - }, - "@vitest/browser": { - "optional": true - }, - "@vitest/ui": { - "optional": true - }, - "happy-dom": { - "optional": true - }, - "jsdom": { - "optional": true - } - } - }, "node_modules/vscode-uri": { "version": "3.0.8", "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.8.tgz", @@ -5376,23 +4996,6 @@ "node": ">= 8" } }, - "node_modules/why-is-node-running": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", - "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", - "dev": true, - "license": "MIT", - "dependencies": { - "siginfo": "^2.0.0", - "stackback": "0.0.2" - }, - "bin": { - "why-is-node-running": "cli.js" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", diff --git a/package.json b/package.json index d2046610b82c220d69bdcdffdea1db0c4eb12498..1db9e6fecd006fa3512b978b7efd77e4353b77ee 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,6 @@ "dev": "concurrently -n Client,Server -c '#325D79,#45ADA8' 'npm:dev:client' 'npm:dev:server'", "dev:client": "vite", "dev:server": "nodemon --use-strict src/server/app.js | pino-pretty -t 'yyyy-mm-dd HH:MM:ss'", - "test": "NODE_ENV='production' vitest", "build": "vue-tsc && vite build", "build:db": "node src/scripts/buildDatabase.js", "stats": "node src/scripts/displayStatistics", @@ -57,7 +56,6 @@ "rollup-plugin-gzip": "^4.0.1", "typescript": "^5.7.3", "vite": "^6.1.0", - "vitest": "^3.0.5", "vue-tsc": "^2.2.0" } } diff --git a/src/server/config/env.test.js b/src/server/config/env.test.js deleted file mode 100644 index f026aa22e75fd81a8d0c3614ae0471a1e80adde3..0000000000000000000000000000000000000000 --- a/src/server/config/env.test.js +++ /dev/null @@ -1,69 +0,0 @@ -// ABSD -// Copyright (C) 2023 Institut Pasteur -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see <http://www.gnu.org/licenses/>. - -import { describe, expect, test } from 'vitest' -import serverConfig from './env' - -describe('Server env config', () => { - test('Config should exists', () => { - expect(serverConfig).toBeDefined() - }) - - test('Config should have all and only the defined properties', () => { - const envVariables = Object.keys(serverConfig).sort() - expect(envVariables).toStrictEqual([ - "ABSD_DB_HOST", - "ABSD_DB_NAME", - "ABSD_DB_PORT", - "ABSD_SERVER_HOST", - "ABSD_SERVER_PORT", - "ABSD_SERVER_PROXY", - "NODE_ENV", - ]) - }) - - test('ABSD_DB_HOST should be a string', () => { - expect(serverConfig.ABSD_DB_HOST).toBeTypeOf('string') - }) - - test('ABSD_DB_NAME should be a string', () => { - expect(serverConfig.ABSD_DB_NAME).toBeTypeOf('string') - }) - - test('ABSD_DB_PORT should be a positive integer', () => { - expect(serverConfig.ABSD_DB_PORT).toBeTypeOf('number') - expect(serverConfig.ABSD_DB_PORT).toBeGreaterThan(0) - expect(serverConfig.ABSD_DB_PORT % 1).toBe(0) - }) - - test('ABSD_SERVER_HOST should be a string', () => { - expect(serverConfig.ABSD_SERVER_HOST).toBeTypeOf('string') - }) - - test('ABSD_SERVER_PORT should be a positive integer', () => { - expect(serverConfig.ABSD_SERVER_PORT).toBeTypeOf('number') - expect(serverConfig.ABSD_SERVER_PORT).toBeGreaterThan(0) - expect(serverConfig.ABSD_SERVER_PORT % 1).toBe(0) - }) - - test('ABSD_SERVER_PROXY should be a boolean', () => { - expect(serverConfig.ABSD_SERVER_PROXY).toBeTypeOf('boolean') - }) - - test('NODE_ENV should be either development or production', () => { - expect(serverConfig.NODE_ENV).toBeOneOf(['development', 'production']) - }) -}) diff --git a/src/server/models/Antibody.test.js b/src/server/models/Antibody.test.js deleted file mode 100644 index 7dd24c344dbdc7f03a9a42db11e63f6cf29c4119..0000000000000000000000000000000000000000 --- a/src/server/models/Antibody.test.js +++ /dev/null @@ -1,140 +0,0 @@ -// ABSD -// Copyright (C) 2023 Institut Pasteur -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see <http://www.gnu.org/licenses/>. - -import { describe, expect, test } from "vitest" -import { Antibody } from "./Antibody" - -describe('Antibody class', () => { - test('should be a class', () => { - const antibody = new Antibody() - expect(antibody).toBeInstanceOf(Antibody) - }) - - test('should define the static method "listSources"', () => { - expect(Antibody.listSources).toBeInstanceOf(Function) - }) - - test('should define the static method "listSegments"', () => { - expect(Antibody.listSegments).toBeInstanceOf(Function) - }) - - test('should define the static method "generateHashId"', () => { - expect(Antibody.generateHashId).toBeInstanceOf(Function) - }) - - test('should define the static method "toFasta"', () => { - expect(Antibody.toFasta).toBeInstanceOf(Function) - }) - - test('should define the static method "toString"', () => { - expect(Antibody.toString).toBeInstanceOf(Function) - }) -}) - -describe('Antibody class methods', () => { - const antibody = { - "id": "368.22.A.0062", - "species": "Homo sapiens", - "hashId": "53775feae7c2d86939d15177e0b963e20504141de8601e28ab701f9f4fe9d3a2", - "lightChain": { - "headers": [ - { - "id": "368.22.A.0062", - "vGeneSegment": "IGLV4", - "source": "CoV-AbDab", - "header": "368.22.A.0062_B-cells SARS-CoV2 Human Patient_human_light_" - }, - { - "id": "SRR17729722", - "vGeneSegment": "IGLV4", - "source": "PairedNGS", - "header": "PRJNA777934|SRR17729722|human|GCTGCAGGTACCTACA|IGHV3_30*04,IGHD4_23*01,IGHJ3*02,IGHG1|IGLV4_69*01,IGLJ1*01,IGLC1|AKVEGGNYVGAFDV|QTWGTGIHV_light" - }, - { - "id": "SRR17778139", - "vGeneSegment": "IGLV4", - "source": "PairedNGS", - "header": "PRJNA777934|SRR17778139|human|GCTGCAGGTACCTACA|IGHV3_30*04,IGHD4_23*01,IGHJ3*02|IGLV4_69*01,IGLJ1*01,IGLC1|AKVEGGNYVGAFDV|QTWGTGIHV_light" - } - ], - "sequence": "QLVLTQSPSASASLGASVKLTCTLSSGHSSYAIAWHQQQPEKGPRYLMKLNSDGSHSEGDGIPDRFSGSSSGAERYLTISSLQSEDEADYYCQTWGTGIHVFGTGTKVTVL", - "rawFasta": "368.22.A.0062|||368.22.A.0062_B-cells SARS-CoV2 Human Patient_human_light_;368.22.A.0062;IGLV4;CoV-AbDab|||PRJNA777934|SRR17729722|human|GCTGCAGGTACCTACA|IGHV3_30*04,IGHD4_23*01,IGHJ3*02,IGHG1|IGLV4_69*01,IGLJ1*01,IGLC1|AKVEGGNYVGAFDV|QTWGTGIHV_light;SRR17729722;IGLV4;PairedNGS|||PRJNA777934|SRR17778139|human|GCTGCAGGTACCTACA|IGHV3_30*04,IGHD4_23*01,IGHJ3*02|IGLV4_69*01,IGLJ1*01,IGLC1|AKVEGGNYVGAFDV|QTWGTGIHV_light;SRR17778139;IGLV4;PairedNGS" - }, - "heavyChain": { - "headers": [ - { - "id": "368.22.A.0062", - "vGeneSegment": "IGHV3", - "source": "CoV-AbDab", - "header": "368.22.A.0062_B-cells SARS-CoV2 Human Patient_human_heavy_" - }, - { - "id": "SRR17729722", - "vGeneSegment": "IGHV3", - "source": "PairedNGS", - "header": "PRJNA777934|SRR17729722|human|GCTGCAGGTACCTACA|IGHV3_30*04,IGHD4_23*01,IGHJ3*02,IGHG1|IGLV4_69*01,IGLJ1*01,IGLC1|AKVEGGNYVGAFDV|QTWGTGIHV_heavy" - }, - { - "id": "SRR17778139", - "vGeneSegment": "IGHV3", - "source": "PairedNGS", - "header": "PRJNA777934|SRR17778139|human|GCTGCAGGTACCTACA|IGHV3_30*04,IGHD4_23*01,IGHJ3*02|IGLV4_69*01,IGLJ1*01,IGLC1|AKVEGGNYVGAFDV|QTWGTGIHV_heavy" - } - ], - "sequence": "QVQLVESGGGVVQPGRSLRLSCAASGFTFSGYAMHWVRQAPGKGLEWVAVISYDGSNRYYADSVKGRFSISRDNSKKTLYLQMNSLRDEDTAVYYCAKVEGGNYVGAFDVWGQGTMVTVSS", - "rawFasta": "368.22.A.0062|||368.22.A.0062_B-cells SARS-CoV2 Human Patient_human_heavy_;368.22.A.0062;IGHV3;CoV-AbDab|||PRJNA777934|SRR17729722|human|GCTGCAGGTACCTACA|IGHV3_30*04,IGHD4_23*01,IGHJ3*02,IGHG1|IGLV4_69*01,IGLJ1*01,IGLC1|AKVEGGNYVGAFDV|QTWGTGIHV_heavy;SRR17729722;IGHV3;PairedNGS|||PRJNA777934|SRR17778139|human|GCTGCAGGTACCTACA|IGHV3_30*04,IGHD4_23*01,IGHJ3*02|IGLV4_69*01,IGLJ1*01,IGLC1|AKVEGGNYVGAFDV|QTWGTGIHV_heavy;SRR17778139;IGHV3;PairedNGS" - } - } - - test('"listSources" should return the list of sources as a Set', () => { - const sources = Antibody.listSources(antibody) - const expected = new Set() - .add('CoV-AbDab') - .add('PairedNGS') - expect(sources).toStrictEqual(expected) - }) - - test('"listSegments" should return the list of gene segments as an object containg two Sets', () => { - const segments = Antibody.listSegments(antibody) - const expected = { - heavyChain: new Set().add('IGHV3'), - lightChain: new Set().add('IGLV4') - } - expect(segments).toStrictEqual(expected) - }) - - test('"generateHashId" should return the SHA256 of the antibody', () => { - const hashId = Antibody.generateHashId(antibody) - expect(hashId).toBe(antibody.hashId) - }) - - test('"toFasta" should return the FASTA version of the antibody', () => { - const fasta = Antibody.toFasta(antibody) - const expected = ">368.22.A.0062|||368.22.A.0062_B-cells SARS-CoV2 Human Patient_human_light_;368.22.A.0062;IGLV4;CoV-AbDab|||PRJNA777934|SRR17729722|human|GCTGCAGGTACCTACA|IGHV3_30*04,IGHD4_23*01,IGHJ3*02,IGHG1|IGLV4_69*01,IGLJ1*01,IGLC1|AKVEGGNYVGAFDV|QTWGTGIHV_light;SRR17729722;IGLV4;PairedNGS|||PRJNA777934|SRR17778139|human|GCTGCAGGTACCTACA|IGHV3_30*04,IGHD4_23*01,IGHJ3*02|IGLV4_69*01,IGLJ1*01,IGLC1|AKVEGGNYVGAFDV|QTWGTGIHV_light;SRR17778139;IGLV4;PairedNGS" - .concat("\nQLVLTQSPSASASLGASVKLTCTLSSGHSSYAIAWHQQQPEKGPRYLMKLNSDGSHSEGDGIPDRFSGSSSGAERYLTISSLQSEDEADYYCQTWGTGIHVFGTGTKVTVL") - .concat("\n>368.22.A.0062|||368.22.A.0062_B-cells SARS-CoV2 Human Patient_human_heavy_;368.22.A.0062;IGHV3;CoV-AbDab|||PRJNA777934|SRR17729722|human|GCTGCAGGTACCTACA|IGHV3_30*04,IGHD4_23*01,IGHJ3*02,IGHG1|IGLV4_69*01,IGLJ1*01,IGLC1|AKVEGGNYVGAFDV|QTWGTGIHV_heavy;SRR17729722;IGHV3;PairedNGS|||PRJNA777934|SRR17778139|human|GCTGCAGGTACCTACA|IGHV3_30*04,IGHD4_23*01,IGHJ3*02|IGLV4_69*01,IGLJ1*01,IGLC1|AKVEGGNYVGAFDV|QTWGTGIHV_heavy;SRR17778139;IGHV3;PairedNGS") - .concat("\nQVQLVESGGGVVQPGRSLRLSCAASGFTFSGYAMHWVRQAPGKGLEWVAVISYDGSNRYYADSVKGRFSISRDNSKKTLYLQMNSLRDEDTAVYYCAKVEGGNYVGAFDVWGQGTMVTVSS") - - expect(fasta).toBe(expected) - }) - - test('"toString" should return the JSON version of the antibody', () => { - const json = Antibody.toString(antibody) - const expected = JSON.stringify(antibody) - - expect(json).toBe(expected) - }) -}) diff --git a/src/server/utils/escapeString.test.js b/src/server/utils/escapeString.test.js deleted file mode 100644 index f9eb19af3e025dbc6ea198d3ac5f5b893fef6aa0..0000000000000000000000000000000000000000 --- a/src/server/utils/escapeString.test.js +++ /dev/null @@ -1,25 +0,0 @@ -// ABSD -// Copyright (C) 2023 Institut Pasteur -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see <http://www.gnu.org/licenses/>. - -import { expect, test } from "vitest" -import escapeString from "./escapeString" - -test('Should escape all dangerous characters in a regex', () => { - const dangerousString = "abc.de*fgh+ijk?lmn^op$qr{st}u(vw)xyzABCDE|FG\HIJK[LM]NOPQRSTUVWXYZ123456789-_%&#@" - const safeString = "abc\\.de\\*fgh\\+ijk\\?lmn\\^op\\$qr\\{st\\}u\\(vw\\)xyzABCDE\\|FGHIJK\\[LM\\]NOPQRSTUVWXYZ123456789-_%&#@" - - expect(escapeString(dangerousString)).toBe(safeString) -}) diff --git a/vite.config.ts b/vite.config.ts index f0a8bc86dfa55eeded30af4d2845122fe633e4b2..9bf30c186c309536f93cf82ca23ce74ba23b2385 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -30,11 +30,5 @@ export default defineConfig({ __VUE_OPTIONS_API__: false, __VUE_PROD_DEVTOOLS__: false, __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false - }, - test: { - // https://vitest.dev/config/ - name: 'Server tests', - root: 'src/server', - include: ['**/*.test.js'] } })