Skip to content

Commit

Permalink
tests: fix failing to run cal tests
Browse files Browse the repository at this point in the history
  • Loading branch information
WyvernIXTL committed Feb 27, 2025
1 parent 9f75e94 commit d636189
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 35 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ dist
dist-test
lib-web
lib-esm
test_cal_db
110 changes: 108 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"test": "npm run test:node && npm run test:web",
"test:local": "npm run test",
"test:ci": "npm run test",
"test:node": "mocha -r ts-node/register -r tsconfig-paths/register -r test/fixtures.ts ./test/index.ts --project ./test/tsconfig.json --exit",
"test:node": "mocha -r ts-node/register -r tsconfig-paths/register -r test/fixtures.ts ./test/index.ts --project ./test/tsconfig.json --exit --delay",
"test:local:node": "npm run test:node",
"test:web": "browsertest-runner",
"test:web:debug": "browsertest-runner --debug"
Expand All @@ -47,10 +47,10 @@
"uuid": "10.0.0"
},
"devDependencies": {
"@nmshd/rs-crypto-node": "^0.1.1",
"@js-soft/eslint-config-ts": "^1.6.13",
"@js-soft/license-check": "1.0.9",
"@js-soft/ts-serval": "2.0.10",
"@nmshd/rs-crypto-node": "^0.1.1",
"@types/chai": "^5.0.0",
"@types/libsodium-wrappers-sumo": "^0.7.8",
"@types/mocha": "^10.0.9",
Expand All @@ -71,6 +71,13 @@
"webpack": "^5.95.0",
"webpack-cli": "^5.1.4"
},
"optionalDependencies": {
"@nmshd/rs-crypto-node-win32-x64-msvc": "^0.1.1",
"@nmshd/rs-crypto-node-darwin-x64": "^0.1.1",
"@nmshd/rs-crypto-node-darwin-arm64": "^0.1.1",
"@nmshd/rs-crypto-node-arm64-gnu": "^0.1.1",
"@nmshd/rs-crypto-node-linux-x64-gnu": "^0.1.1"
},
"publishConfig": {
"access": "public",
"provenance": true
Expand Down
64 changes: 33 additions & 31 deletions test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,37 @@ import { CryptoSignatureTest } from "./crypto/CryptoSignature.test";
import { CryptoStateTest } from "./crypto/CryptoStateTest.test";
import { SodiumWrapperTest } from "./crypto/SodiumWrapperTest.test";

SodiumWrapper.ready()
.then(() => {
SodiumWrapperTest.run();
CryptoDerivationTest.run();
CryptoReflectionTest.run();
CryptoRelationshipTest.run();
CryptoEncryptionTest.run();
CryptoHashTest.run();
CryptoExchangeTest.run();
CryptoPrivateKeyTest.run();
CryptoPublicKeyTest.run();
CryptoRandomTest.run();
CryptoPasswordGeneratorTest.run();
CryptoSecretKeyTest.run();
CryptoSignatureTest.run();
CryptoStateTest.run();
BufferTest.run();
})
.catch((e) => console.log(e));
// This is valid: https://mochajs.org/#delayed-root-suite
// eslint-disable-next-line @typescript-eslint/no-floating-promises
(async function () {
// === CAL ===
await initCryptoLayerProviders({
factoryFunctions: { getAllProviders, createProvider, createProviderFromName, getProviderCapabilities },
// eslint-disable-next-line @typescript-eslint/naming-convention
keyMetadataStoreConfig: { FileStoreConfig: { db_dir: "./test_cal_db" } },
// eslint-disable-next-line @typescript-eslint/naming-convention
keyMetadataStoreAuth: { StorageConfigPass: "12345678" },
providersToBeInitialized: [{ providerName: "SoftwareProvider" }]
});
CryptoLayerProviderTest.run();

initCryptoLayerProviders({
factoryFunctions: { getAllProviders, createProvider, createProviderFromName, getProviderCapabilities },
// eslint-disable-next-line @typescript-eslint/naming-convention
keyMetadataStoreConfig: { FileStoreConfig: { db_dir: "./test_cal_db" } },
// eslint-disable-next-line @typescript-eslint/naming-convention
keyMetadataStoreAuth: { StorageConfigPass: "12345678" },
providersToBeInitialized: [{ providerName: "SoftwareProvider" }]
})
.then(() => {
CryptoLayerProviderTest.run();
})
.catch((e) => console.log(e));
// === Other ===
await SodiumWrapper.ready();
SodiumWrapperTest.run();
CryptoDerivationTest.run();
CryptoReflectionTest.run();
CryptoRelationshipTest.run();
CryptoEncryptionTest.run();
CryptoHashTest.run();
CryptoExchangeTest.run();
CryptoPrivateKeyTest.run();
CryptoPublicKeyTest.run();
CryptoRandomTest.run();
CryptoPasswordGeneratorTest.run();
CryptoSecretKeyTest.run();
CryptoSignatureTest.run();
CryptoStateTest.run();
BufferTest.run();

run();
})();

0 comments on commit d636189

Please sign in to comment.