You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
790 B
TypeScript

import { db, initializeDatabase } from '../../src/db';
import { describe, test, expect, beforeEach } from 'bun:test';
describe('Database', () => {
beforeEach(() => {
// Reset database between tests
db.exec('DROP TABLE IF EXISTS tasks');
db.exec('DROP TABLE IF EXISTS task_assignments');
db.exec('DROP TABLE IF EXISTS users');
db.exec('DROP TABLE IF EXISTS groups');
initializeDatabase();
});
test('should create all required tables', () => {
const tables = db
.query("SELECT name FROM sqlite_master WHERE type='table'")
.all()
.map((t: any) => t.name);
expect(tables).toContain('tasks');
expect(tables).toContain('task_assignments');
expect(tables).toContain('users');
expect(tables).toContain('groups');
});
});