Skip to content

Commit 2c27d36

Browse files
committed
Squashed commit of the following:
commit 535fbf5b8ebd6f8b4b8e0259c52c4af1e6f181a1 Author: pablof7z <[email protected]> Date: Wed Mar 19 22:19:51 2025 +0000 more fixes commit 14f4a70b17441924bc139bdd204fd638edfd98a4 Author: pablof7z <[email protected]> Date: Wed Mar 19 20:55:50 2025 +0000 tests and prettier commit 17acfbf9ba901ecf6f1d62e9031e5ef1b3720388 Author: pablof7z <[email protected]> Date: Wed Mar 19 20:44:10 2025 +0000 cleanup
1 parent 33ad60e commit 2c27d36

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1749
-2724
lines changed

ndk-cache-dexie/jest.config.ts

-16
This file was deleted.

ndk-cache-nostr/jest.config.ts

-11
This file was deleted.

ndk-cache-nostr/package.json

-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"dev": "pnpm build --watch",
1919
"build": "tsup src/index.ts --format cjs,esm --dts",
2020
"clean": "rm -rf dist",
21-
"test": "jest",
2221
"lint": "prettier --check . && eslint .",
2322
"format": "prettier --write ."
2423
},
@@ -46,10 +45,7 @@
4645
"@nostr-dev-kit/eslint-config-custom": "workspace:*",
4746
"@nostr-dev-kit/tsconfig": "workspace:*",
4847
"@types/debug": "^4.1.7",
49-
"@types/jest": "^29.5.5",
5048
"@types/node": "^18.15.11",
51-
"jest": "^29.7.0",
52-
"ts-jest": "^29.1.2",
5349
"ts-node": "^10.9.2",
5450
"tsup": "^7.2.0"
5551
}

ndk-cache-redis/jest.config.ts

-11
This file was deleted.

ndk-cache-redis/package.json

-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"dev": "pnpm build --watch",
1919
"build": "tsup src/index.ts --format cjs,esm --dts",
2020
"clean": "rm -rf dist",
21-
"test": "jest",
2221
"lint": "prettier --check . && eslint .",
2322
"format": "prettier --write ."
2423
},
@@ -48,10 +47,7 @@
4847
"@nostr-dev-kit/eslint-config-custom": "workspace:*",
4948
"@nostr-dev-kit/tsconfig": "workspace:*",
5049
"@types/debug": "^4.1.7",
51-
"@types/jest": "^29.5.5",
5250
"@types/node": "^18.15.11",
53-
"jest": "^29.7.0",
54-
"ts-jest": "^29.1.2",
5551
"ts-node": "^10.9.2",
5652
"tsup": "^7.2.0"
5753
}

ndk-core/jest.config.ts

-15
This file was deleted.

ndk-core/package.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
],
4444
"scripts": {
4545
"dev": "pnpm build --watch",
46-
"build": "tsup src/index.ts --format cjs,esm --dts && tsup src/workers/sig-verification.ts --format cjs,esm --dts -d dist/workers; tsup test/index.ts --format cjs,esm --dts -d dist/test",
46+
"build": "tsup src/index.ts --format cjs,esm --dts && tsup src/workers/sig-verification.ts --format cjs,esm --dts -d dist/workers",
4747
"build:core:esm": "tsup src/index.ts --format esm --dts",
4848
"clean": "rm -rf dist docs",
4949
"test": "vitest run",
@@ -67,16 +67,13 @@
6767
"packageManager": "[email protected]",
6868
"devDependencies": {
6969
"@nostr-dev-kit/eslint-config-custom": "workspace:*",
70+
"@nostr-dev-kit/ndk-test-utils": "workspace:*",
7071
"@nostr-dev-kit/tsconfig": "workspace:*",
7172
"@types/debug": "^4.1.12",
72-
"@types/jest": "^29.5.5",
7373
"@types/node": "^22.13.10",
7474
"esbuild": "^0.25.1",
7575
"esbuild-plugin-alias": "^0.2.1",
7676
"esm-loader-typescript": "^1.0.6",
77-
"jest": "^29.7.0",
78-
"jest-fetch-mock": "^3.0.3",
79-
"ts-jest": "^29.2.5",
8077
"ts-node": "^10.9.2",
8178
"tsd": "^0.31.2",
8279
"tsup": "^8.4.0",

ndk-core/src/events/encode.test.ts

+12-6
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,23 @@ import { NDKEvent } from ".";
33
import { NDKRelay } from "../relay";
44
import type { EventPointer } from "../user";
55
import { NDKPrivateKeySigner } from "../signers/private-key";
6-
import { describe, it, expect, vi } from "vitest";
6+
import { describe, it, expect, vi, beforeEach } from "vitest";
77
import { NDK } from "../ndk";
8+
import { EventGenerator } from "@nostr-dev-kit/ndk-test-utils";
89

910
describe("event.encode", () => {
10-
it("encodes all relays the event is known to be on", async () => {
11-
const event = new NDKEvent(undefined);
12-
event.kind = 1;
13-
await event.sign(NDKPrivateKeySigner.generate());
11+
let mockNdk: NDK;
1412

13+
beforeEach(() => {
1514
// Create a mock NDK instance
16-
const mockNdk = new NDK();
15+
mockNdk = new NDK();
16+
EventGenerator.setNDK(mockNdk);
17+
});
18+
19+
it("encodes all relays the event is known to be on", async () => {
20+
// Use EventGenerator to create a kind 1 text note
21+
const event = EventGenerator.createEvent(1);
22+
await event.sign(NDKPrivateKeySigner.generate());
1723

1824
// Mock the onRelays getter to return our test relays
1925
const testRelays = [

0 commit comments

Comments
 (0)