test: getZapSplits function return empty object

This commit is contained in:
P. Reis 2024-07-19 19:30:31 -03:00
parent 09eb444c9b
commit 1f9896bdbf

View file

@ -34,3 +34,27 @@ Deno.test('Get zap splits in DittoZapSplits format', async () => {
assertEquals(await getZapSplits(store, 'garbage'), undefined);
});
Deno.test('Zap split is empty', async () => {
const { store } = await getTestDB();
const sk = generateSecretKey();
const pubkey = getPublicKey(sk);
const event = genEvent({
kind: 30078,
tags: [
['d', 'pub.ditto.zapSplits'],
['p', 'baka'],
],
}, sk);
await store.event(event);
const eventFromDb = await store.query([{ kinds: [30078], authors: [pubkey] }]);
assertEquals(eventFromDb.length, 1);
const zapSplits = await getZapSplits(store, pubkey);
assertEquals(zapSplits, {});
});