|
|
@ -18,7 +18,10 @@ describe('Database', () => {
|
|
|
|
.all()
|
|
|
|
.all()
|
|
|
|
.map((t: any) => t.name);
|
|
|
|
.map((t: any) => t.name);
|
|
|
|
|
|
|
|
|
|
|
|
expect(tables.sort()).toEqual(['groups', 'task_assignments', 'tasks', 'users'].sort());
|
|
|
|
const expectedTables = ['groups', 'task_assignments', 'tasks', 'users'];
|
|
|
|
|
|
|
|
// Filter out system tables like sqlite_sequence
|
|
|
|
|
|
|
|
const userTables = tables.filter(t => !t.startsWith('sqlite_'));
|
|
|
|
|
|
|
|
expect(userTables.sort()).toEqual(expectedTables.sort());
|
|
|
|
|
|
|
|
|
|
|
|
// Verify tasks table schema
|
|
|
|
// Verify tasks table schema
|
|
|
|
const tasksColumns = db
|
|
|
|
const tasksColumns = db
|
|
|
@ -27,5 +30,14 @@ describe('Database', () => {
|
|
|
|
.map((c: any) => c.name);
|
|
|
|
.map((c: any) => c.name);
|
|
|
|
expect(tasksColumns).toContain('description');
|
|
|
|
expect(tasksColumns).toContain('description');
|
|
|
|
expect(tasksColumns).toContain('due_date');
|
|
|
|
expect(tasksColumns).toContain('due_date');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Verify foreign key constraint
|
|
|
|
|
|
|
|
const fkInfo = db
|
|
|
|
|
|
|
|
.query("PRAGMA foreign_key_list(task_assignments)")
|
|
|
|
|
|
|
|
.all();
|
|
|
|
|
|
|
|
expect(fkInfo.length).toBe(1);
|
|
|
|
|
|
|
|
expect(fkInfo[0].from).toBe('task_id');
|
|
|
|
|
|
|
|
expect(fkInfo[0].to).toBe('id');
|
|
|
|
|
|
|
|
expect(fkInfo[0].table).toBe('tasks');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|