seogeneratorserver/tests/storage/idempotence.test.js
StillHammer dbf1a3de8c Add technical plan for multi-format export system
Added plan.md with complete architecture for format-agnostic content generation:
- Support for Markdown, HTML, Plain Text, JSON formats
- New FormatExporter module with neutral data structure
- Integration strategy with existing ContentAssembly and ArticleStorage
- Bonus features: SEO metadata generation, readability scoring, WordPress Gutenberg format
- Implementation roadmap with 4 phases (6h total estimated)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 16:14:29 +08:00

18 lines
676 B
JavaScript

import test from 'node:test';
import assert from 'node:assert';
import { safeImport } from '../_helpers/path.js';
test('ArticleStorage idempotence (workKey) prevents duplicates', async () => {
const res = safeImport('ArticleStorage');
if (!res.ok || typeof res.mod.workKey !== 'function') {
console.warn('[SKIP] ArticleStorage.workKey missing');
return;
}
const { workKey } = res.mod;
const A = { instructions:'x', persona:{a:1}, template:'t', seed:1 };
const B = { instructions:'x', persona:{a:1}, template:'t', seed:1 };
const k1 = workKey(A);
const k2 = workKey(B);
assert.equal(k1, k2, 'same inputs should yield same key');
});