mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
test(hydrate): add zap receipt, kind 9735
This commit is contained in:
parent
4f0f1182b8
commit
07c364b829
1 changed files with 33 additions and 0 deletions
|
|
@ -143,3 +143,36 @@ Deno.test('hydrateEvents(): report pubkey and post // kind 1984 --- WITHOUT stat
|
||||||
};
|
};
|
||||||
assertEquals(reportEvent, expectedEvent);
|
assertEquals(reportEvent, expectedEvent);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Deno.test('hydrateEvents(): zap sender, zap amount, zapped post // kind 9735 --- WITHOUT stats', async () => {
|
||||||
|
const relay = new MockRelay();
|
||||||
|
await using db = await createTestDB();
|
||||||
|
|
||||||
|
const zapSender = await eventFixture('kind-0-jack');
|
||||||
|
const zapReceipt = await eventFixture('kind-9735-jack-zap-patrick');
|
||||||
|
const zappedPost = await eventFixture('kind-1-being-zapped');
|
||||||
|
const zapReceiver = await eventFixture('kind-0-patrick');
|
||||||
|
|
||||||
|
// Save events to database
|
||||||
|
await relay.event(zapSender);
|
||||||
|
await relay.event(zapReceipt);
|
||||||
|
await relay.event(zappedPost);
|
||||||
|
await relay.event(zapReceiver);
|
||||||
|
|
||||||
|
await hydrateEvents({
|
||||||
|
events: [zapReceipt],
|
||||||
|
store: relay,
|
||||||
|
kysely: db.kysely,
|
||||||
|
});
|
||||||
|
|
||||||
|
const expectedEvent: DittoEvent = {
|
||||||
|
...zapReceipt,
|
||||||
|
zap_sender: zapSender,
|
||||||
|
zapped: {
|
||||||
|
...zappedPost,
|
||||||
|
author: zapReceiver,
|
||||||
|
},
|
||||||
|
zap_amount: 5225000, // millisats
|
||||||
|
};
|
||||||
|
assertEquals(zapReceipt, expectedEvent);
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue