test
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user