seo-generator-server/tests/storage/idempotence.test.js
StillHammer 4f60de68d6 Fix BatchProcessor initialization and add comprehensive test suite
- Fix BatchProcessor constructor to avoid server blocking during startup
- Add comprehensive integration tests for all modular combinations
- Enhance CLAUDE.md documentation with new test commands
- Update SelectiveLayers configuration for better LLM allocation
- Add AutoReporter system for test automation
- Include production workflow validation tests

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-19 14:17:49 +08:00

23 lines
794 B
JavaScript

import test from 'node:test';
import assert from 'node:assert';
import { safeImport } from '../_helpers/path.js';
import { AutoReporter } from '../reporters/AutoReporter.js';
// Auto-Reporter Configuration
const autoReporter = new AutoReporter();
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');
});