Upgrade Nostrify to v0.15, use MockRelay in tests instead of NCache

This commit is contained in:
Alex Gleason 2024-04-26 12:33:52 -05:00
parent f3bc12252a
commit f61d29eb66
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
5 changed files with 10 additions and 9 deletions

View File

@ -16,7 +16,7 @@
"exclude": ["./public"],
"imports": {
"@/": "./src/",
"@nostrify/nostrify": "jsr:@nostrify/nostrify@^0.14.3",
"@nostrify/nostrify": "jsr:@nostrify/nostrify@^0.15.0",
"@std/cli": "jsr:@std/cli@^0.223.0",
"@std/json": "jsr:@std/json@^0.223.0",
"@std/streams": "jsr:@std/streams@^0.223.0",

View File

@ -1,4 +1,5 @@
import { LNURL, NostrEvent, NSchema as n } from '@nostrify/nostrify';
import { NostrEvent, NSchema as n } from '@nostrify/nostrify';
import { LNURL } from '@nostrify/nostrify/ln';
import { Conf } from '@/config.ts';
import { db } from '@/db.ts';
import { addRelays } from '@/db/relays.ts';

View File

@ -1,6 +1,5 @@
// deno-lint-ignore-file require-await
import {
Machina,
NIP50,
NostrEvent,
NostrFilter,
@ -9,6 +8,7 @@ import {
NostrRelayEVENT,
NRelay,
} from '@nostrify/nostrify';
import { Machina } from '@nostrify/nostrify/utils';
import { matchFilter } from '@/deps.ts';
import { DittoEvent } from '@/interfaces/DittoEvent.ts';

View File

@ -1,6 +1,6 @@
import { assertEquals } from '@/deps-test.ts';
import { hydrateEvents } from '@/storages/hydrate.ts';
import { NCache } from 'jsr:@nostrify/nostrify';
import { MockRelay } from '@nostrify/nostrify/test';
import event0 from '~/fixtures/events/event-0.json' with { type: 'json' };
import event0madePost from '~/fixtures/events/event-0-the-one-who-post-and-users-repost.json' with { type: 'json' };
@ -24,7 +24,7 @@ import event6ofQuoteRepost from '~/fixtures/events/event-6-of-quote-repost.json'
import { DittoEvent } from '@/interfaces/DittoEvent.ts';
Deno.test('hydrateEvents(): author --- WITHOUT stats', async () => {
const db = new NCache({ max: 100 });
const db = new MockRelay();
const event0copy = structuredClone(event0);
const event1copy = structuredClone(event1);
@ -45,7 +45,7 @@ Deno.test('hydrateEvents(): author --- WITHOUT stats', async () => {
});
Deno.test('hydrateEvents(): repost --- WITHOUT stats', async () => {
const db = new NCache({ max: 100 });
const db = new MockRelay();
const event0madePostCopy = structuredClone(event0madePost);
const event0madeRepostCopy = structuredClone(event0madeRepost);
@ -75,7 +75,7 @@ Deno.test('hydrateEvents(): repost --- WITHOUT stats', async () => {
});
Deno.test('hydrateEvents(): quote repost --- WITHOUT stats', async () => {
const db = new NCache({ max: 100 });
const db = new MockRelay();
const event0madeQuoteRepostCopy = structuredClone(event0madeQuoteRepost);
const event0copy = structuredClone(event0);
@ -103,7 +103,7 @@ Deno.test('hydrateEvents(): quote repost --- WITHOUT stats', async () => {
});
Deno.test('hydrateEvents(): repost of quote repost --- WITHOUT stats', async () => {
const db = new NCache({ max: 100 });
const db = new MockRelay();
const event0copy = structuredClone(event0madeRepostWithQuoteRepost);
const event1copy = structuredClone(event1futureIsMine);

View File

@ -1,4 +1,4 @@
import { LNURL, LNURLDetails } from '@nostrify/nostrify';
import { LNURL, LNURLDetails } from '@nostrify/nostrify/ln';
import { Debug } from '@/deps.ts';
import { SimpleLRU } from '@/utils/SimpleLRU.ts';
import { Time } from '@/utils/time.ts';