Make tests use in-memory db
This commit is contained in:
parent
2aa05dc194
commit
420a086f1d
@ -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');
|
||||
|
@ -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() });
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user