import test from 'node:test';
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';

const demoPath = new URL('../scripts/record_release_demo.mjs', import.meta.url);
const builderPath = new URL('../scripts/build_release.py', import.meta.url);

test('release demo visibly explains the CI-protected browser path without overstating safety', async () => {
  const demo = await readFile(demoPath, 'utf8');

  assert.match(demo, /Automated checks replay this synthetic path before review/);
  assert.match(demo, /One clear photo action\. Manual logging stays one tap away\./);
  assert.match(demo, /tests\/fixtures\/synthetic-type4\.jpg/);
  assert.match(demo, /AI may suggest visible form, broad color, and image quality — never symptoms or diagnosis/);
  assert.match(demo, /Hermes Agent connected/);
  assert.match(demo, /Photos stay out of chat/);
  assert.match(demo, /I have rectal bleeding/);
  assert.match(demo, /Urgent language is intercepted deterministically before Hermes/);
  assert.match(demo, /SLEEK\. SIMPLE\.<br>HERMES-POWERED\./);
});

test('release builder gates the sleek shell and Hermes chat browser path', async () => {
  const builder = await readFile(builderPath, 'utf8');
  assert.match(builder, /"test:sleek"/);
  assert.match(builder, /"sleek_hermes_chat_acceptance": "passed"/);
  assert.match(builder, /Sleek three-destination shell/);
});
