@davoodmehraban89 / LifeMate / commits / fabc9cb
Fork 0

LifeMate — Personal, Family & Learning Companion

test: define Cloudflare Neon migration contract

davoodmehraban89 committed Oct 7, 2026 at 09:03 UTC fabc9cbc656e21791633a6cc9ce820c8eaf2818f
1 file changed +29
backend/tests/cloudflare_neon_contract.test.js new
+29
@@ -0,0 +1,29 @@
1 +import test from 'node:test';
2 +import assert from 'node:assert/strict';
3 +import fs from 'node:fs';
4 +
5 +const read = (path) => fs.readFileSync(new URL(`../../${path}`, import.meta.url), 'utf8');
6 +
7 +test('Cloudflare Worker deployment is configured for PostgreSQL', () => {
8 + const config = read('backend/wrangler.jsonc');
9 + assert.match(config, /lifeguide-api/);
10 + assert.match(config, /2026-10-07/);
11 + assert.match(config, /nodejs_compat/);
12 + assert.match(config, /src\/worker\.js/);
13 +
14 + const worker = read('backend/src/worker.js');
15 + assert.match(worker, /DATABASE_URL/);
16 + assert.match(worker, /NEON_DATABASE_URL/);
17 + assert.match(worker, /httpServerHandler/);
18 + assert.match(worker, /lifeguide-api/);
19 +});
20 +
21 +test('migration runbook preserves rollback until verification passes', () => {
22 + const runbook = read('docs/operations/CLOUDFLARE_NEON_MIGRATION.md');
23 + assert.match(runbook, /Neon PostgreSQL/i);
24 + assert.match(runbook, /Cloudflare Workers/i);
25 + assert.match(runbook, /Railway/i);
26 + assert.match(runbook, /rollback/i);
27 + assert.match(runbook, /pg_dump/);
28 + assert.match(runbook, /pg_restore/);
29 +});