unrip/test/inventory-sync-static.test.mjs
philipp 5805ea801d
Some checks failed
deploy / deploy (push) Failing after 37s
Fix inventory refresh error logging
Proof: npm test; node --check src/apps/inventory-sync.mjs; node --test test/inventory-sync-static.test.mjs test/trading-config.test.mjs.

Assumptions: Inventory refresh failures should be logged with the active pair when available, but error logging must not throw if trading config loading or refresh work fails.

Still fake: No BTC/USDC external reference price route or liquidity model exists; non-nBTC/EURe pairs still fail closed on missing price route until that path is built.
2026-05-13 13:22:31 +02:00

12 lines
534 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/inventory-sync.mjs', import.meta.url), 'utf8');
test('inventory refresh error logging cannot reference block-scoped trading config', () => {
assert.match(source, /let activePair = null;/);
assert.match(source, /activePair = tradingConfig\.activePair;/);
assert.match(source, /pair: activePair/);
assert.doesNotMatch(source, /pair: tradingConfig\.activePair/);
});