Merge branch 'nostrify-15' into 'main'

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

See merge request soapbox-pub/ditto!188
This commit is contained in:
Alex Gleason 2024-04-26 17:36:57 +00:00
commit edbe3395b3
5 changed files with 10 additions and 9 deletions

View File

@ -16,7 +16,7 @@
"exclude": ["./public"], "exclude": ["./public"],
"imports": { "imports": {
"@/": "./src/", "@/": "./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/cli": "jsr:@std/cli@^0.223.0",
"@std/json": "jsr:@std/json@^0.223.0", "@std/json": "jsr:@std/json@^0.223.0",
"@std/streams": "jsr:@std/streams@^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 { Conf } from '@/config.ts';
import { db } from '@/db.ts'; import { db } from '@/db.ts';
import { addRelays } from '@/db/relays.ts'; import { addRelays } from '@/db/relays.ts';

View File

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

View File

@ -1,6 +1,6 @@
import { assertEquals } from '@/deps-test.ts'; import { assertEquals } from '@/deps-test.ts';
import { hydrateEvents } from '@/storages/hydrate.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 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' }; 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'; import { DittoEvent } from '@/interfaces/DittoEvent.ts';
Deno.test('hydrateEvents(): author --- WITHOUT stats', async () => { Deno.test('hydrateEvents(): author --- WITHOUT stats', async () => {
const db = new NCache({ max: 100 }); const db = new MockRelay();
const event0copy = structuredClone(event0); const event0copy = structuredClone(event0);
const event1copy = structuredClone(event1); const event1copy = structuredClone(event1);
@ -45,7 +45,7 @@ Deno.test('hydrateEvents(): author --- WITHOUT stats', async () => {
}); });
Deno.test('hydrateEvents(): repost --- 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 event0madePostCopy = structuredClone(event0madePost);
const event0madeRepostCopy = structuredClone(event0madeRepost); const event0madeRepostCopy = structuredClone(event0madeRepost);
@ -75,7 +75,7 @@ Deno.test('hydrateEvents(): repost --- WITHOUT stats', async () => {
}); });
Deno.test('hydrateEvents(): quote 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 event0madeQuoteRepostCopy = structuredClone(event0madeQuoteRepost);
const event0copy = structuredClone(event0); 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 () => { 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 event0copy = structuredClone(event0madeRepostWithQuoteRepost);
const event1copy = structuredClone(event1futureIsMine); 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 { Debug } from '@/deps.ts';
import { SimpleLRU } from '@/utils/SimpleLRU.ts'; import { SimpleLRU } from '@/utils/SimpleLRU.ts';
import { Time } from '@/utils/time.ts'; import { Time } from '@/utils/time.ts';