|
|
|
|
@ -38,7 +38,7 @@ describe('Database', () => {
|
|
|
|
|
.map((t: any) => t.name);
|
|
|
|
|
|
|
|
|
|
// Order matters if foreign keys are involved during creation, though SQLite is flexible
|
|
|
|
|
const expectedTables = ['users', 'groups', 'tasks', 'task_assignments'];
|
|
|
|
|
const expectedTables = ['users', 'groups', 'tasks', 'task_assignments', 'response_queue'];
|
|
|
|
|
const userTables = tables.filter(t => !t.startsWith('sqlite_'));
|
|
|
|
|
// Check if all expected tables exist, order might vary slightly depending on execution
|
|
|
|
|
expect(userTables).toHaveLength(expectedTables.length);
|
|
|
|
|
@ -82,6 +82,14 @@ describe('Database', () => {
|
|
|
|
|
const group = testDb.query("SELECT active FROM groups WHERE id = 'test-group'").get();
|
|
|
|
|
expect(group.active).toBe(1); // SQLite uses 1 for TRUE
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('response_queue table should have required columns', () => {
|
|
|
|
|
const columns = testDb
|
|
|
|
|
.query("PRAGMA table_info(response_queue)")
|
|
|
|
|
.all()
|
|
|
|
|
.map((c: any) => c.name);
|
|
|
|
|
expect(columns).toEqual(['id', 'recipient', 'message', 'status', 'attempts', 'last_error', 'created_at', 'updated_at']);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('Foreign Keys', () => {
|
|
|
|
|
|