Make tests use in-memory db

This commit is contained in:
Alex Gleason 2023-03-28 12:30:53 -05:00
parent 2aa05dc194
commit 420a086f1d
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
2 changed files with 2 additions and 8 deletions

View File

@ -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');

View File

@ -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() });