feat: enhance moderation functionality with type improvements and global broadcaster integration

This commit is contained in:
MythEclipse
2026-05-15 07:13:37 +07:00
parent 930c399484
commit 235c1120c2
12 changed files with 287 additions and 133 deletions
+10 -2
View File
@@ -16,6 +16,14 @@ import {
} from "../../src/moderation/messageStore";
import type { MessageRecord } from "../../src/moderation/types";
interface TestDatabase {
run(sql: string): void;
}
function getTestDatabase(): TestDatabase {
return getDatabase() as unknown as TestDatabase;
}
const logger = createChildLogger("messageStoreQueries.test");
describe("message cursor helpers", () => {
@@ -36,7 +44,7 @@ describe("message query integration tests", () => {
beforeAll(async () => {
await initializeDatabase();
// Create tables using Drizzle schema (SQLite doesn't support migrations with PostgreSQL syntax)
const db = getDatabase() as any;
const db = getTestDatabase();
try {
// Create messages table
await db.run(`
@@ -75,7 +83,7 @@ describe("message query integration tests", () => {
beforeEach(async () => {
// Clear messages table before each test
try {
const db = getDatabase() as any;
const db = getTestDatabase();
await db.run(`DELETE FROM "messages"`);
} catch (error) {
logger.debug({ error }, "Could not clear messages table");