Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions jest.setup.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
beforeAll(async () => {
const { SodiumWrapper } = require("@nmshd/crypto");
await SodiumWrapper.ready();
});
963 changes: 527 additions & 436 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@types/node": "^24.12.4",
"enhanced-publish": "^1.1.8",
"eslint": "^10.3.0",
"jest": "^30.3.0",
"jest": "^30.4.2",
"jest-expect-message": "^1.1.3",
"madge": "^8.0.0",
"npm-check-updates": "^22.1.1",
Expand Down
3 changes: 2 additions & 1 deletion packages/app-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"preset": "ts-jest",
"setupFilesAfterEnv": [
"./test/customMatchers.ts",
"jest-expect-message"
"jest-expect-message",
"../../jest.setup.cjs"
],
"testEnvironment": "node",
"testTimeout": 60000,
Expand Down
2 changes: 1 addition & 1 deletion packages/app-runtime/test/customMatchers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ApplicationError, EventConstructor, Result } from "@js-soft/ts-utils";
import { MockEventBus } from "./lib";
import { MockEventBus } from "./lib/MockEventBus";

import "./lib/MockUIBridge.matchers";

Expand Down
22 changes: 14 additions & 8 deletions packages/app-runtime/test/modules/SSEModule.test.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
import { MessageReceivedEvent } from "@nmshd/runtime";
import { AppRuntime, LocalAccountSession } from "../../src";
import { MockEventBus, TestUtil } from "../lib";
import type { AppRuntime, LocalAccountSession } from "../../src";
import { MockEventBus } from "../lib/MockEventBus";

// eslint-disable-next-line jest/no-disabled-tests -- disabled because the Backbone currently isn't performant enough in the CI
describe.skip("SSEModuleTest", function () {
const eventBus = new MockEventBus();
// Note: even when skipped, Jest executes top-level imports.
// Keep runtime-heavy imports lazy to avoid teardown-time libsodium init errors.
let testUtil: typeof import("../lib/TestUtil").TestUtil;

let runtime: AppRuntime;
let session1: LocalAccountSession;
let session2: LocalAccountSession;

beforeAll(async function () {
runtime = await TestUtil.createRuntime({ modules: { sse: { enabled: true, baseUrlOverride: process.env.NMSHD_TEST_BASEURL_SSE_SERVER } } }, undefined, eventBus);
({ TestUtil: testUtil } = await import("../lib/TestUtil"));

runtime = await testUtil.createRuntime({ modules: { sse: { enabled: true, baseUrlOverride: process.env.NMSHD_TEST_BASEURL_SSE_SERVER } } }, undefined, eventBus);
await runtime.start();

const accounts = await TestUtil.provideAccounts(runtime, 2);
const accounts = await testUtil.provideAccounts(runtime, 2);
session1 = await runtime.selectAccount(accounts[0].id);
session2 = await runtime.selectAccount(accounts[1].id);

await TestUtil.addRelationship(session1, session2);
await testUtil.addRelationship(session1, session2);
});

afterAll(async function () {
Expand All @@ -28,9 +32,11 @@ describe.skip("SSEModuleTest", function () {
afterEach(() => eventBus.reset());

test("should auto sync when new external events arrive", async function () {
const message = await TestUtil.sendMessage(session1, session2);
const { MessageReceivedEvent: messageReceivedEvent } = await import("@nmshd/runtime");

const message = await testUtil.sendMessage(session1, session2);

const received = await eventBus.waitForEvent(MessageReceivedEvent, (e) => e.eventTargetAddress === session2.account.address!, 20000);
const received = await eventBus.waitForEvent(messageReceivedEvent, (e) => e.eventTargetAddress === session2.account.address!, 20000);

expect(received.data.id).toBe(message.id);
});
Expand Down
3 changes: 2 additions & 1 deletion packages/consumption/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"preset": "ts-jest",
"setupFilesAfterEnv": [
"./test/customMatchers.ts",
"jest-expect-message"
"jest-expect-message",
"../../jest.setup.cjs"
],
"testEnvironment": "node",
"testTimeout": 60000,
Expand Down
3 changes: 2 additions & 1 deletion packages/content/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"maxWorkers": 5,
"preset": "ts-jest",
"setupFilesAfterEnv": [
"jest-expect-message"
"jest-expect-message",
"../../jest.setup.cjs"
],
"testEnvironment": "node",
"testTimeout": 60000,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { CoreId, FileReference } from "@nmshd/core-types";
import { CoreBuffer, CryptoEncryptionAlgorithm, CryptoSecretKey, SodiumWrapper } from "@nmshd/crypto";
import { CoreBuffer, CryptoEncryptionAlgorithm, CryptoSecretKey } from "@nmshd/crypto";
import { TransferFileOwnershipRequestItem } from "../../../src";

describe("TransferFileOwnershipRequestItem", () => {
let fileReference: FileReference;

beforeAll(async function () {
await SodiumWrapper.ready();

beforeAll(function () {
fileReference = FileReference.from({
id: CoreId.from("FILxxxxxxxxxxxxxxxxx"),
key: CryptoSecretKey.from({
Expand Down
3 changes: 2 additions & 1 deletion packages/core-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"maxWorkers": 1,
"preset": "ts-jest",
"setupFilesAfterEnv": [
"jest-expect-message"
"jest-expect-message",
"../../jest.setup.cjs"
],
"testEnvironment": "node",
"testTimeout": 60000,
Expand Down
3 changes: 2 additions & 1 deletion packages/runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"setupFilesAfterEnv": [
"./test/customMatchers.ts",
"./test/disableTimeoutForDebugging.ts",
"jest-expect-message"
"jest-expect-message",
"../../jest.setup.cjs"
],
"testEnvironment": "node",
"testTimeout": 60000,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import { PasswordLocationIndicatorOptions } from "@nmshd/core-types";
import { SodiumWrapper } from "@nmshd/crypto";
import { TokenAndTemplateCreationValidator } from "../../src/useCases/common";

describe("TokenAndTemplateCreationValidator", () => {
let isValidPasswordLocationIndicator: (value: unknown) => boolean;

beforeAll(async function () {
await SodiumWrapper.ready();

beforeAll(function () {
isValidPasswordLocationIndicator = TokenAndTemplateCreationValidator["isValidPasswordLocationIndicator"];
});

Expand Down
5 changes: 3 additions & 2 deletions packages/transport/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"preset": "ts-jest",
"setupFilesAfterEnv": [
"./test/customMatchers.ts",
"jest-expect-message"
"jest-expect-message",
"../../jest.setup.cjs"
],
"testEnvironment": "node",
"testPathIgnorePatterns": [
Expand Down Expand Up @@ -91,7 +92,7 @@
"@types/luxon": "^3.7.1",
"@types/qs": "^6.15.1",
"correlation-id": "^5.2.0",
"expect": "^30.3.0",
"expect": "^30.4.1",
"testcontainers": "^12.0.0",
"ts-mockito": "^2.6.1"
},
Expand Down