unrip/test/strategy-threshold-config.test.mjs
philipp 2ffa4b17f1
Some checks failed
deploy / deploy (push) Failing after 34s
Move trading config into Postgres
Proof: npm test passed 159/159; npm run operator-dashboard:build passed; repo-local Postgres importer smoke test imported 163 live 1Click tokens with only 3 inventory-enabled seed assets and nBTC/EURe pairs at 49 bps.

Assumptions: Forgejo main push is the repo deployment path; production has existing repo-managed POSTGRES_URL/POSTGRES_PASSWORD/NEAR_INTENTS_API_KEY secrets; startup seed may create initial current nBTC/EURe config but must preserve DB runtime pair flags after creation.

Still fake: no live funds movement was attempted; imported supported assets remain catalog-only unless explicitly enabled in DB; production rollout evidence still depends on the Forgejo deploy job completing after this push.
2026-05-12 21:34:58 +02:00

24 lines
1,006 B
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import {
CURRENT_PAIR_KEY,
buildSeedStrategyConfig,
} from '../src/core/trading-config.mjs';
test('repo DB seed carries the approved 49 bps current-pair edge', () => {
const config = buildSeedStrategyConfig(CURRENT_PAIR_KEY);
assert.equal(config.edgeBps, 49);
});
test('kubernetes production config does not carry pair, asset, or edge env vars', () => {
const manifest = readFileSync(new URL('../deploy/k8s/base/unrip.yaml', import.meta.url), 'utf8');
assert.doesNotMatch(manifest, /NEAR_INTENTS_PAIR_FILTER/);
assert.doesNotMatch(manifest, /TRADING_BTC_/);
assert.doesNotMatch(manifest, /TRADING_EURE_/);
assert.doesNotMatch(manifest, /STRATEGY_GROSS_THRESHOLD_PCT/);
assert.doesNotMatch(manifest, /STRATEGY_MAX_NOTIONAL_EURE/);
assert.doesNotMatch(manifest, /INTENT_REQUEST_DEFAULT_AMOUNT_EURE/);
assert.doesNotMatch(manifest, /INTENT_REQUEST_MAX_AMOUNT_EURE/);
});