@davoodmehraban89 / LifeMate / commits / 20ec019
Fork 0

LifeMate — Personal, Family & Learning Companion

test: align final contract with existing notification table

davoodmehraban89 committed Oct 5, 2026 at 19:42 UTC 20ec0198a8307ca4f7a23c84b9eff134e9407908
1 file changed +3 -22
backend/tests/phase6_contract.test.js
+3 -22
@@ -1,25 +1,6 @@
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 -});
4 +const read=(path)=>fs.readFileSync(new URL(`../${path}`,import.meta.url),'utf8');
5 +test('final feature backend contract exists with privacy and Iran education guards',()=>{const source=read('src/phase6.js');assert.match(source,/secondary_1/);assert.match(source,/menstrual/);assert.match(source,/notification/);assert.match(source,/calendar/);assert.match(source,/chap\.sch\.ir/);assert.match(source,/owner_user_id=\$1/);assert.doesNotMatch(source,/families\/:.*menstrual/i);});
6 +test('final migration defines required tables and grade 7 catalog',()=>{const sql=read('migrations/0005_iran_family_learning.sql');for(const name of ['education_profile','curriculum_subject','textbook_catalog','iran_calendar_event','menstrual_cycle_entry'])assert.match(sql,new RegExp(`create table(?: if not exists)? ${name}`,'i'));assert.match(sql,/alter table notification_preference/i);assert.match(sql,/secondary_1/);assert.match(sql,/\b7\b/);assert.match(sql,/ریاضی/);});