@davoodmehraban89 / LifeMate / commits / 28f35e8
Fork 0

LifeMate — Personal, Family & Learning Companion

test: add red-first final feature contract

davoodmehraban89 committed Oct 5, 2026 at 19:39 UTC 28f35e82711fa2acbfa8d47d65bac8ff58b40b6e
1 file changed +25
backend/tests/phase6_contract.test.js new
+25
@@ -0,0 +1,25 @@
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('final feature backend contract exists with privacy and Iran education guards', () => {
8 + const source = read('src/phase6.js');
9 + assert.match(source, /secondary_1/);
10 + assert.match(source, /menstrual/);
11 + assert.match(source, /notification/);
12 + assert.match(source, /calendar/);
13 + assert.match(source, /chap\.sch\.ir/);
14 + assert.doesNotMatch(source, /parent_guardian.*menstrual|guardian.*menstrual/i);
15 +});
16 +
17 +test('final migration defines required tables and grade 7 catalog', () => {
18 + const sql = read('migrations/0005_iran_family_learning.sql');
19 + for (const name of ['education_profile','curriculum_subject','textbook_catalog','iran_calendar_event','notification_preference','menstrual_cycle_entry']) {
20 + assert.match(sql, new RegExp(`create table(?: if not exists)? ${name}`, 'i'));
21 + }
22 + assert.match(sql, /secondary_1/);
23 + assert.match(sql, /\b7\b/);
24 + assert.match(sql, /ریاضی/);
25 +});