unrip/test/history-writer-static.test.mjs
philipp 8507403b0f
Some checks failed
deploy / deploy (push) Failing after 27s
Consume durable history from topic beginning
Proof: npm test; node --test test/history-writer-static.test.mjs test/kafka-topics.test.mjs test/environment-status-history.test.mjs; node --check src/apps/history-writer.mjs.

Assumptions: Durable history consumers are idempotent by event_id, so from-beginning subscription is safe when a topic has no committed group offset.

Still fake: This protects durable event capture for repo-owned Kafka topics; it does not backfill events that were never published to Kafka.
2026-04-17 14:41:22 +02:00

10 lines
495 B
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const source = readFileSync(new URL('../src/apps/history-writer.mjs', import.meta.url), 'utf8');
test('history writer consumes from beginning so first events on newly-created topics are durable', () => {
assert.match(source, /consumer\.subscribe\(\{ topic, fromBeginning: true \}\)/);
assert.doesNotMatch(source, /consumer\.subscribe\(\{ topic, fromBeginning: false \}\)/);
});