linkedin-studio/tests/persona-reviewer-fixture.test.mjs
Kjell Tore Guttormsen 9111f006cc refactor(linkedin-studio): move agent fasit fixtures + tests out of agents/ (v0.5.3)
The 6 long-form-review fasit fixtures (agents/fixtures/*-cases.md) were registered
by Claude Code as junk `fixtures:*` agents because agents/ is scanned recursively.
They are test fixtures, not capabilities. Moved them + their 6 lint tests to
tests/ + tests/fixtures/ and retargeted the 5 agent fasit-refs. Count-neutral
namespace hygiene (ls agents/*.md still 19).

- agents/fixtures/*-cases.md            -> tests/fixtures/        (6)
- agents/__tests__/*-fixture.test.mjs   -> tests/                 (6; ../fixtures -> ./fixtures)
- 5 agent refs ${CLAUDE_PLUGIN_ROOT}/agents/fixtures -> /tests/fixtures
- version-sync 0.5.2 -> 0.5.3 (plugin.json / README badge / CLAUDE.md / CHANGELOG)

Verify: fixture-lint 35/35 at new path; render 20/20, hooks 139/139; test-runner 109/0/0.
Reinstall/reload required for the 6 spurious agents to leave the registry.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CrTb8ktf1XZWEVwgz5MTTo
2026-06-24 13:29:57 +02:00

69 lines
2.4 KiB
JavaScript

import { describe, test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
// Lint-test for the persona-reviewer fasit fixture.
// Mirrors the structure-only discipline of state-updater.test.mjs and
// fact-checker-fixture.test.mjs: this test asserts the SHAPE of the fixture —
// one reader persona carrying all five library fields, a non-empty sample
// draft, the six judging axes, and both review modes documented. Whether the
// agent's live flags actually match the fasit directions is [GATE]/[OPERATØR],
// never self-certified here.
const FIXTURE_PATH = fileURLToPath(
new URL('./fixtures/persona-reviewer-cases.md', import.meta.url)
);
const fixture = readFileSync(FIXTURE_PATH, 'utf8');
// The five persona field keys, lowercase to match config/personas.template.md.
const PERSONA_FIELDS = ['rolle', 'avkobler', 'overbeviser', 'ekspertise', 'sjargong'];
// The six judging axes (plan Step 6 / fasit §6.3).
const AXES = [
'Krok', // hook holds?
'Resonans', // does the point land?
'Tone', // tone fit for this reader
'Troverdighet', // credibility
'Leder-takeaway', // leader takeaway + concrete action
'Lengde', // length / drive
];
// Both review modes must be documented (resonance + conversion).
const MODES = ['resonans', 'konverter'];
describe('persona-reviewer fixture structure', () => {
test('documents one persona with all five library fields', () => {
for (const field of PERSONA_FIELDS) {
assert.ok(
new RegExp(`\\*\\*${field}\\*\\*`).test(fixture),
`fixture must document the persona field **${field}**`
);
}
});
test('contains a non-empty sample-text section', () => {
const m = fixture.match(/##\s+Sample-tekst\b([\s\S]*?)(?=\n##\s|$)/i);
assert.ok(m, 'fixture must have a "## Sample-tekst" section');
assert.ok(
m[1].trim().length > 80,
'the sample-text section must contain a real draft excerpt, not a stub'
);
});
test('documents all six judging axes', () => {
for (const axis of AXES) {
assert.ok(fixture.includes(axis), `fixture must name the axis "${axis}"`);
}
});
test('documents both review modes (resonance + conversion)', () => {
for (const mode of MODES) {
assert.ok(
new RegExp(mode, 'i').test(fixture),
`fixture must document the "${mode}" mode`
);
}
});
});