From 420a086f1df629b069d5f79c53f825bfaad70f67 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 28 Mar 2023 12:30:53 -0500 Subject: [PATCH] Make tests use in-memory db --- src/policies/anti-duplication-policy.test.ts | 5 +---- src/policies/rate-limit-policy.test.ts | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/policies/anti-duplication-policy.test.ts b/src/policies/anti-duplication-policy.test.ts index 1e37f27..d04d258 100644 --- a/src/policies/anti-duplication-policy.test.ts +++ b/src/policies/anti-duplication-policy.test.ts @@ -6,12 +6,9 @@ import antiDuplicationPolicy from './anti-duplication-policy.ts'; Deno.test({ name: 'blocks events that post the same content too quickly', fn: async () => { + const opts = { databaseUrl: undefined }; const content = 'Spicy peppermint apricot mediterranean ginger carrot spiced juice edamame hummus'; - const opts = { - databaseUrl: `sqlite:///tmp/${crypto.randomUUID()}.sqlite3`, - }; - const msg1 = buildInputMessage({ event: buildEvent({ content }) }); assertEquals((await antiDuplicationPolicy(msg1, opts)).action, 'accept'); diff --git a/src/policies/rate-limit-policy.test.ts b/src/policies/rate-limit-policy.test.ts index 91f33d3..fa95bbe 100644 --- a/src/policies/rate-limit-policy.test.ts +++ b/src/policies/rate-limit-policy.test.ts @@ -6,10 +6,7 @@ import rateLimitPolicy from './rate-limit-policy.ts'; Deno.test({ name: 'blocks events from IPs that are publishing events too quickly', fn: async () => { - const opts = { - max: 4, - databaseUrl: `sqlite:///tmp/${crypto.randomUUID()}.sqlite3`, - }; + const opts = { max: 4, databaseUrl: undefined }; const msg = buildInputMessage({ sourceType: 'IP4', sourceInfo: '1.1.1.1', event: buildEvent() });