From 26dd4606ed26c7d907a9f0348862829713047af9 Mon Sep 17 00:00:00 2001 From: "P. Reis" Date: Fri, 10 May 2024 10:35:04 -0300 Subject: [PATCH] test: UserStore with 100.00% code coverage --- src/storages/UserStore.test.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/storages/UserStore.test.ts b/src/storages/UserStore.test.ts index 11f96cb..42c0439 100644 --- a/src/storages/UserStore.test.ts +++ b/src/storages/UserStore.test.ts @@ -8,7 +8,7 @@ import userMe from '~/fixtures/events/event-0-makes-repost-with-quote-repost.jso import blockEvent from '~/fixtures/events/kind-10000-black-blocks-user-me.json' with { type: 'json' }; import event1authorUserMe from '~/fixtures/events/event-1-quote-repost-will-be-reposted.json' with { type: 'json' }; -Deno.test('query events of users that are not blocked', async () => { +Deno.test('query events of users that are not muted', async () => { const userBlackCopy = structuredClone(userBlack); const userMeCopy = structuredClone(userMe); const blockEventCopy = structuredClone(blockEvent); @@ -24,4 +24,19 @@ Deno.test('query events of users that are not blocked', async () => { await store.event(event1authorUserMeCopy); assertEquals(await store.query([{ kinds: [1] }], { limit: 1 }), []); + assertEquals(await store.isMuted(userMeCopy.pubkey), true); +}); + +Deno.test('user never muted anyone', async () => { + const userBlackCopy = structuredClone(userBlack); + const userMeCopy = structuredClone(userMe); + + const db = new MockRelay(); + + const store = new UserStore(userBlackCopy.pubkey, db); + + await store.event(userBlackCopy); + await store.event(userMeCopy); + + assertEquals(await store.isMuted(userMeCopy.pubkey), false); });