42 lines
1.8 KiB
JavaScript
42 lines
1.8 KiB
JavaScript
const test = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
|
|
const page = fs.readFileSync(new URL('../index.html', `file://${__filename}`), 'utf8');
|
|
|
|
test('admin can select a searched account before opening its conversations', () => {
|
|
assert.match(page, /Välj konto att följa/);
|
|
assert.match(page, /chooserSelect\.value\);/);
|
|
assert.match(page, /\/api\/admin\/players\?q=/);
|
|
});
|
|
|
|
test('conversation transcript exposes player and narrator messages as expandable replies', () => {
|
|
assert.match(page, /function renderAdminConversations/);
|
|
assert.match(page, /payload\.player_message/);
|
|
assert.match(page, /payload\.reply \|\| payload\.npc_reply/);
|
|
assert.match(page, /aria-expanded/);
|
|
assert.match(page, /renderDecisionProvenance\(group, event, detail\)/);
|
|
});
|
|
|
|
test('selected replies reveal AI, Luau and Rust provenance without injecting HTML', () => {
|
|
assert.match(page, /function renderDecisionProvenance/);
|
|
assert.match(page, /interaction\.prompt_yaml/);
|
|
assert.match(page, /interaction\.external_call/);
|
|
assert.match(page, /details\.luau_trace/);
|
|
assert.match(page, /details\.rust_validation/);
|
|
assert.match(page, /element\.textContent = text/);
|
|
});
|
|
|
|
test('account trace can be paged until all stored turns are loaded', () => {
|
|
assert.match(page, /Visa äldre samtalsturer/);
|
|
assert.match(page, /\?limit=\$\{trace\.limit \|\| 200\}&offset=\$\{adminTraceOffset\}/);
|
|
});
|
|
|
|
test('admin can switch to a storyteller-only reading view and return to diagnostics', () => {
|
|
assert.match(page, /Lättläst konversation/);
|
|
assert.match(page, /Visa felsökningsspår/);
|
|
assert.match(page, /root\.classList\.toggle\('admin-simple-conversation', adminSimpleConversation\)/);
|
|
assert.match(page, /story\.className = 'admin-story-reply'/);
|
|
assert.match(page, /article > :not\(\.admin-story-reply\)/);
|
|
});
|