|
|
@ -31,12 +31,13 @@ describe('Database', () => {
|
|
|
|
expect(tasksColumns).toContain('description');
|
|
|
|
expect(tasksColumns).toContain('description');
|
|
|
|
expect(tasksColumns).toContain('due_date');
|
|
|
|
expect(tasksColumns).toContain('due_date');
|
|
|
|
|
|
|
|
|
|
|
|
// Verify groups table has last_verified column
|
|
|
|
// Verify groups table columns
|
|
|
|
const groupsColumns = db
|
|
|
|
const groupsColumns = db
|
|
|
|
.query("PRAGMA table_info(groups)")
|
|
|
|
.query("PRAGMA table_info(groups)")
|
|
|
|
.all()
|
|
|
|
.all()
|
|
|
|
.map((c: any) => c.name);
|
|
|
|
.map((c: any) => c.name);
|
|
|
|
expect(groupsColumns).toContain('last_verified');
|
|
|
|
expect(groupsColumns).toContain('last_verified');
|
|
|
|
|
|
|
|
expect(groupsColumns).toContain('active');
|
|
|
|
|
|
|
|
|
|
|
|
// Verify foreign key constraint
|
|
|
|
// Verify foreign key constraint
|
|
|
|
const fkInfo = db
|
|
|
|
const fkInfo = db
|
|
|
@ -46,5 +47,13 @@ describe('Database', () => {
|
|
|
|
expect(fkInfo[0].from).toBe('task_id');
|
|
|
|
expect(fkInfo[0].from).toBe('task_id');
|
|
|
|
expect(fkInfo[0].to).toBe('id');
|
|
|
|
expect(fkInfo[0].to).toBe('id');
|
|
|
|
expect(fkInfo[0].table).toBe('tasks');
|
|
|
|
expect(fkInfo[0].table).toBe('tasks');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Verify default active status
|
|
|
|
|
|
|
|
db.exec(`
|
|
|
|
|
|
|
|
INSERT INTO groups (id, community_id, name)
|
|
|
|
|
|
|
|
VALUES ('test-group', 'test-community', 'Test Group')
|
|
|
|
|
|
|
|
`);
|
|
|
|
|
|
|
|
const group = db.query("SELECT active FROM groups WHERE id = 'test-group'").get();
|
|
|
|
|
|
|
|
expect(group.active).toBe(1); // SQLite stores TRUE as 1
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|