feat(mindspace): enforce PostgreSQL user data delivery

This commit is contained in:
john
2026-07-13 15:29:29 +08:00
parent b33c943b69
commit a6620fb719
57 changed files with 2779 additions and 164 deletions
@@ -0,0 +1,25 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { parseArgs } from './migrate-mindspace-sqlite-to-postgres.mjs';
test('migration CLI defaults to dry-run', () => {
assert.deepEqual(parseArgs(['--source', '/tmp/a.sqlite', '--user-id', 'user-id']), {
apply: false,
replaceShadow: false,
source: '/tmp/a.sqlite',
userId: 'user-id',
help: false,
});
});
test('migration CLI requires explicit source and user', () => {
assert.throws(() => parseArgs([]), /--source 和 --user-id 必填/);
});
test('migration CLI recognizes explicit apply', () => {
assert.equal(parseArgs(['--apply', '--source', '/tmp/a.sqlite', '--user-id', 'user-id']).apply, true);
});
test('migration CLI requires explicit replace-shadow for destructive reruns', () => {
assert.equal(parseArgs(['--replace-shadow', '--source', '/tmp/a.sqlite', '--user-id', 'user-id']).replaceShadow, true);
});