Split NATS modules: splitter, WORM bloom archive, aggregator, docs-master
Some checks are pending
offline / test (push) Waiting to run
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.
This commit is contained in:
parent
ca693366dc
commit
8f9707a3b7
39 changed files with 893 additions and 0 deletions
28
packages/verae-archive-worm/test/archive.test.js
Normal file
28
packages/verae-archive-worm/test/archive.test.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
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);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue