feat(FN-1266): add dashboard API integration tests for budget endpoints

This commit is contained in:
gsxdsm
2026-04-10 01:05:21 -07:00
parent 7b014670c0
commit 3c58dbe08d
10 changed files with 1520 additions and 14 deletions

View File

@@ -106,7 +106,7 @@ describe("Database", () => {
});
it("seeds schema version", () => {
expect(db.getSchemaVersion()).toBe(26);
expect(db.getSchemaVersion()).toBe(27);
});
it("seeds lastModified", () => {
@@ -129,7 +129,7 @@ describe("Database", () => {
it("is idempotent - calling init() twice does not fail", () => {
expect(() => db.init()).not.toThrow();
expect(db.getSchemaVersion()).toBe(26);
expect(db.getSchemaVersion()).toBe(27);
});
it("does not overwrite existing config on re-init", () => {
@@ -735,8 +735,8 @@ describe("schema migrations", () => {
// Now run init() which should trigger migration
db.init();
// Verify version bumped to 22 (includes v1→v2 through v21→v22)
expect(db.getSchemaVersion()).toBe(26);
// Verify version bumped to 27 (includes v1→v2 through v26→v27)
expect(db.getSchemaVersion()).toBe(27);
// Verify new columns exist and existing data is intact
const cols = db.prepare("PRAGMA table_info(tasks)").all() as Array<{ name: string }>;
@@ -761,11 +761,11 @@ describe("schema migrations", () => {
const db = new Database(kbDir);
db.init();
expect(db.getSchemaVersion()).toBe(26);
expect(db.getSchemaVersion()).toBe(27);
// Re-init should not fail
db.init();
expect(db.getSchemaVersion()).toBe(26);
expect(db.getSchemaVersion()).toBe(27);
db.close();
});
@@ -781,7 +781,7 @@ describe("schema migrations", () => {
db.init();
expect(db.getSchemaVersion()).toBe(26);
expect(db.getSchemaVersion()).toBe(27);
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'agentRatings'").all() as Array<{ name: string }>;
expect(tables).toEqual([{ name: "agentRatings" }]);
@@ -805,7 +805,7 @@ describe("schema migrations", () => {
db.init();
expect(db.getSchemaVersion()).toBe(26);
expect(db.getSchemaVersion()).toBe(27);
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'mission_events'").all() as Array<{ name: string }>;
expect(tables).toEqual([{ name: "mission_events" }]);
@@ -908,8 +908,8 @@ describe("schema migrations", () => {
// Now run init() which should trigger migrations v2→v3→v4
db.init();
// Verify version bumped to 22
expect(db.getSchemaVersion()).toBe(26);
// Verify version bumped to 27
expect(db.getSchemaVersion()).toBe(27);
// Verify new columns exist and existing data is intact
const cols = db.prepare("PRAGMA table_info(tasks)").all() as Array<{ name: string }>;
@@ -1275,7 +1275,7 @@ describe("createDatabase factory", () => {
const db = createDatabase(kbDir);
db.init();
expect(db.getSchemaVersion()).toBe(26);
expect(db.getSchemaVersion()).toBe(27);
expect(db.getLastModified()).toBeGreaterThan(0);
db.close();