Treasury & Bank Transfer Management System — سامانه مدیریت خزانهداری و حوالههای بانکی
ci/windows-dual-app-lab-20261016
ci/public-windows-bridge-probe-20261017
ci/windows-dispatch-bootstrap-20261016
ci/windows-dual-app-lab-20261016
dev/v7-production-failclosed-20261021
feature/reconciliation-guard-20261013
main
phase-1-foundation
phase-1-implementation
phase-2-treasury-core
phase-3-banking-reconciliation
phase-4-operations-enterprise-ux
phase-5-hardening-release
phase-6-production-platform
phase-7-production-infrastructure-bank-golive
phase-7-sql-readonly-ux-20261015
transfer-exe-to-drive-20261006
| 1 | import test from 'node:test'; |
| 2 | import assert from 'node:assert/strict'; |
| 3 | import { createRequire } from 'node:module'; |
| 4 | |
| 5 | const require = createRequire(import.meta.url); |
| 6 | const { isExpectedReadiness } = require('../../electron/ready-check.cjs'); |
| 7 | const ready = JSON.stringify({status:'ready',bankAdapter:'disabled',missing:[]}); |
| 8 | |
| 9 | test('accepts a real TreasuryFlow ready response with banking disabled', () => { |
| 10 | assert.equal(isExpectedReadiness(200, ready), true); |
| 11 | }); |
| 12 | test('rejects an unrelated web page served on port 3210', () => { |
| 13 | assert.equal(isExpectedReadiness(200, '<html>unrelated service</html>'), false); |
| 14 | }); |
| 15 | test('rejects 404 and 503 responses even with ready-looking bodies', () => { |
| 16 | assert.equal(isExpectedReadiness(404, ready), false); |
| 17 | assert.equal(isExpectedReadiness(503, ready), false); |
| 18 | }); |
| 19 | test('rejects a live or unspecified banking adapter', () => { |
| 20 | assert.equal(isExpectedReadiness(200, JSON.stringify({status:'ready',bankAdapter:'live'})), false); |
| 21 | assert.equal(isExpectedReadiness(200, JSON.stringify({status:'ready'})), false); |
| 22 | }); |
| 23 | test('rejects missing, malformed and oversized responses', () => { |
| 24 | assert.equal(isExpectedReadiness(200, ''), false); |
| 25 | assert.equal(isExpectedReadiness(200, '{}'), false); |
| 26 | assert.equal(isExpectedReadiness(200, 'x'.repeat(4097)), false); |
| 27 | }); |