Files
brain/tools/observer-chain-detector.test.mjs
T

33 lines
965 B
JavaScript

import { describe, it, expect } from 'vitest';
import { loadChainMap, chainsFor } from './observer-chain-detector.mjs';
const map = loadChainMap();
describe('chainsFor', () => {
it('returns chain array for a single-chain node', () => {
expect(chainsFor('billing-audit', map)).toEqual(['L13']);
});
it('returns all chains for a multi-chain node', () => {
expect(chainsFor('discovery-interview', map)).toEqual(['L1', 'L2']);
});
it('returns null for direct', () => {
expect(chainsFor('direct', map)).toBeNull();
});
it('returns null for an unknown node', () => {
expect(chainsFor('totally-unknown-xyz', map)).toBeNull();
});
it('returns null for empty/null/undefined', () => {
expect(chainsFor('', map)).toBeNull();
expect(chainsFor(null, map)).toBeNull();
expect(chainsFor(undefined, map)).toBeNull();
});
it('ignores the _note metadata key', () => {
expect(chainsFor('_note', map)).toBeNull();
});
});