// Hybrid-Chain offline teaching model: on-chain-fx-settlement // Fictional fields/states; NOT an API client, authorization system or production implementation. // No network calls, credentials, payments or file writes. Review before running. // Requires Node.js 22+. Run: node --test on-chain-fx-settlement.mjs import test from 'node:test'; import assert from 'node:assert/strict'; export function inspect(record) { if (!record.quoteValid) return 'REQUOTE_REQUIRED'; if (record.legA !== 'final') return 'LEG_A_UNRESOLVED'; if (record.legB !== 'final') return 'LEG_B_UNRESOLVED'; return 'BOTH_LEGS_RECORDED'; } const baseline = { "quoteValid": true, "legA": "final", "legB": "final" }; const cases = [ { "name": "both leg records present", "patch": {}, "expected": "BOTH_LEGS_RECORDED" }, { "name": "quote invalid for release", "patch": { "quoteValid": false }, "expected": "REQUOTE_REQUIRED" }, { "name": "first leg pending", "patch": { "legA": "pending" }, "expected": "LEG_A_UNRESOLVED" }, { "name": "second leg pending", "patch": { "legB": "pending" }, "expected": "LEG_B_UNRESOLVED" } ]; for (const example of cases) { test(example.name, () => { assert.equal(inspect({...baseline, ...example.patch}), example.expected); }); }