Some checks are pending
offline / test (push) Waiting to run
Each module has SUMMARY.md and NATS.md (who sends/receives, subject addresses, payload). Tests: splitter 3, worm 3, aggregator 2. Forgejo repos pushed separately; this commit keeps them in the monorepo.
28 lines
926 B
JavaScript
28 lines
926 B
JavaScript
import { describe, it } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { WormArchive } from '../src/archive.js';
|
|
import { Bloom } from '../src/bloom.js';
|
|
|
|
describe('WormArchive + Bloom', () => {
|
|
it('miss stays silent (null)', () => {
|
|
const a = new WormArchive('archive-a');
|
|
assert.equal(a.query('a'.repeat(64)), null);
|
|
});
|
|
|
|
it('put then query returns records', () => {
|
|
const a = new WormArchive('archive-b');
|
|
const sha = 'b'.repeat(64);
|
|
a.put({ sha256: sha, kind: 'publicMeta', record: { publicMetadata: { t: 1 } } });
|
|
const hit = a.query(sha);
|
|
assert.ok(Array.isArray(hit));
|
|
assert.equal(hit[0].kind, 'publicMeta');
|
|
assert.equal(hit[0].archiveId, 'archive-b');
|
|
});
|
|
|
|
it('bloom reports maybe after add', () => {
|
|
const b = new Bloom();
|
|
assert.equal(b.mightHave('hello'), false);
|
|
b.add('hello');
|
|
assert.equal(b.mightHave('hello'), true);
|
|
});
|
|
});
|