This commit is contained in:
Storme-bit
2026-08-20 05:07:53 -07:00
parent feadf0a1f7
commit 6c953a346a
+8
View File
@@ -4,6 +4,7 @@
// advance user_version correctly, and no-op when the DB is already current.
const { test } = require('node:test');
const assert = require('node:assert');
const Database = require('better-sqlite3');
const { migrate, LATEST_VERSION } = require('../packages/memory-service/src/db/migrations');
// Emulates just the slice of the better-sqlite3 API that migrate() uses.
@@ -63,3 +64,10 @@ test('only migrations newer than the current version run', () => {
assert.deepStrictEqual(order, ['v2', 'v3'], 'v1 is not re-run');
assert.deepStrictEqual(db.setCalls, [2, 3]);
});
test('LATEST_VERSION reflects the appended v1 → v2 migration', () => {
// Guards that adding the access-tracking migration bumped the target version.
// The real SQL is verified out-of-band (scratch run against a DB copy); here we
// only lock the runner-visible contract: the array length drives LATEST_VERSION.
assert.strictEqual(LATEST_VERSION, 2);
});