Refresh materialized view in search test

This commit is contained in:
Alex Gleason 2025-02-12 16:20:04 -06:00
parent 1482ee148e
commit db793a3c6c
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -1,4 +1,5 @@
import { assertEquals } from '@std/assert';
import { sql } from 'kysely';
import { createTestDB } from '@/test.ts';
import { getPubkeysBySearch } from '@/utils/search.ts';
@ -14,6 +15,8 @@ Deno.test('fuzzy search works', async () => {
following_count: 0,
}).execute();
await sql`REFRESH MATERIALIZED VIEW top_authors`.execute(db.kysely);
assertEquals(
await getPubkeysBySearch(db.kysely, { q: 'pat rick', limit: 1, offset: 0, following: new Set() }),
new Set(),
@ -43,6 +46,8 @@ Deno.test('fuzzy search works with offset', async () => {
following_count: 0,
}).execute();
await sql`REFRESH MATERIALIZED VIEW top_authors`.execute(db.kysely);
assertEquals(
await getPubkeysBySearch(db.kysely, { q: 'dosreis.com', limit: 1, offset: 1, following: new Set() }),
new Set(),