717ae1031e
Zanzibar-style authorization graph engine (direct/chain/TTU/defeasible/ binary modes, condensed snapshots, value relations) with 39 rigor test campaigns. Includes fixes for snapshot binary writer/reader format mismatch (snapshot-of-snapshot corruption), possibility write-boundary validation, empty-graph snapshot serialization, relation lookup cache direction collision, config-redefinition cache invalidation, binary threshold semantics, defeasible compiled routing, and comparator reason whitelisting.
29 lines
878 B
JavaScript
29 lines
878 B
JavaScript
import { describe, test } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import fc from 'fast-check';
|
|
import { Arbiter } from '../../src/core/Arbiter.js';
|
|
|
|
describe('Fast-check: node id mapping invariants', () => {
|
|
test('resolveNodeId/resolveKey round-trip', () => {
|
|
fc.assert(
|
|
fc.property(
|
|
fc.set(fc.string({ minLength: 1, maxLength: 12 }), { minLength: 1, maxLength: 20 }),
|
|
(keys) => {
|
|
const arbiter = new Arbiter();
|
|
for (const key of keys) {
|
|
arbiter.addNode(key, 'generic');
|
|
}
|
|
|
|
for (const key of keys) {
|
|
const id = arbiter.resolveNodeId(key);
|
|
assert.ok(id !== undefined && id !== null);
|
|
const roundTrip = arbiter.resolveKey(id);
|
|
assert.strictEqual(roundTrip, key);
|
|
}
|
|
}
|
|
),
|
|
{ numRuns: 50 }
|
|
);
|
|
});
|
|
});
|