feat(linkedin): add persona-reviewer agent (2 modes) + fixture (S5)

This commit is contained in:
Kjell Tore Guttormsen 2026-05-27 20:08:06 +02:00
commit 1faffac303
3 changed files with 392 additions and 0 deletions

View file

@ -0,0 +1,69 @@
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`
);
}
});
});