pediatric-ai-scribe-v3/test/pe-guide-data.test.js
2026-05-08 08:56:21 +02:00

28 lines
1.1 KiB
JavaScript

const { test } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const root = path.join(__dirname, '..');
function read(relativePath) {
return fs.readFileSync(path.join(root, relativePath), 'utf8');
}
test('PE Guide static content is loaded from JSON data', () => {
const source = read('public/js/peGuide.js');
const data = JSON.parse(read('public/data/pe-guide.json'));
assert.match(source, /PE_GUIDE_DATA_URL = '\/data\/pe-guide\.json'/);
assert.match(source, /async function init\(\)/);
assert.match(source, /await loadPeGuideData\(\)/);
assert.doesNotMatch(source, /newborn:\s*\{/);
assert.deepEqual(Object.keys(data.peData), ['newborn', 'infant', 'toddler', 'preschool', 'school', 'adolescent']);
assert.ok(data.peData.newborn.msk.components.length > 0);
assert.ok(data.peData.adolescent.cv.components.length > 0);
assert.ok(data.scales.mrc.rows.length > 0);
assert.ok(data.systemScales.cv.includes('murmurGrade'));
assert.ok(data.respiratorySounds.length >= 7);
assert.ok(data.cardiacSounds.length >= 6);
});