Back to Body Journal
SOURCE / PINNED RELEASE

Made of little things.

Body Journal

Release
e8049f8da4e2…
Author-recorded commit
61c04bf0e8aa…
License
LICENSE
Author’s source reference
nostr://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf/wss%3A%2F%2Fgit.napplet.soy%2F/n-6c4554844c7

Archive hash verified: 4369d778da046a8b…. The source-to-build association is the author’s claim; it has not been independently rebuilt.

tests/case.test.mjs
import assert from 'node:assert/strict';
import test from 'node:test';
import { readFileSync } from 'node:fs';
import { resolve, dirname } from 'node:path';
import { runInNewContext } from 'node:vm';
import ts from 'typescript';
function load(file) {
 const path=resolve(file),module={exports:{}};
 runInNewContext(ts.transpileModule(readFileSync(path,'utf8'),{compilerOptions:{module:ts.ModuleKind.CommonJS,target:ts.ScriptTarget.ES2022}}).outputText,{module,exports:module.exports,require:name=>load(resolve(dirname(path),name.replace(/\.js$/,'.ts')))});
 return module.exports;
}
const {describeRegion,makeConcern,summary,describePose,escape} = load('src/case.ts');
test('surface labels retain patient laterality and distinguish front/back',()=>{
 assert.equal(describeRegion('left-knee',[0,0,1]),'Left knee · front');
 assert.equal(describeRegion('right-knee',[0,0,-1]),'Right knee · back');
 assert.equal(describeRegion('torso',[0.08,0.35,-0.5]),'Left upper back');
 assert.equal(describeRegion('torso',[-0.08,0.35,0.5]),'Right chest');
});
test('an illustrated pose does not become a reported symptom trigger or measured range of motion',()=>{
 const c=makeConcern(1,'Left knee','sitting');c.joints={'left-knee':[1.4,0,0]};
 const text=summary(c);assert.match(text,/Onset not yet provided/);assert.match(text,/Illustrated pose: sitting, left knee bent/);
 assert.doesNotMatch(text,/\bRated|Reported with|degrees|diagnos|chronic/i);
 c.triggers=['Moving'];assert.match(summary(c),/Reported with moving/);
});
test('independent concerns preserve separate marks and pose snapshots',()=>{
 const a=makeConcern(1,'Left knee','standing'),b=makeConcern(2,'Right hand','sitting');
 a.joints['left-knee']=[1.4,0,0];a.marks.push({part:'left-knee'});
 assert.equal(Object.keys(b.joints).length,0);assert.equal(b.marks.length,0);assert.equal(b.pose,'sitting');
 assert.match(describePose(a.pose,a.joints),/left knee bent/);
});
test('general symptoms do not acquire an inferred location or pain score',()=>{
 const c=makeConcern(1,'Fatigue','standing',false);c.type='Other';
 assert.doesNotMatch(summary(c),/Rated|Illustrated|at fatigue/);
});
test('patient wording is escaped for HTML rendering',()=>{
 assert.equal(escape('<img src=x onerror="alert(1)">'), '&lt;img src=x onerror=&quot;alert(1)&quot;&gt;');
});