Treasury & Bank Transfer Management System — سامانه مدیریت خزانه‌داری و حواله‌های بانکی

1 import test from 'node:test';
2 import assert from 'node:assert/strict';
3 import { isIntegrationsEditorReady } from './gui-readiness.mjs';
4
5 const ready = { href:'http://127.0.0.1:3210/integrations', editor:true, copy:true };
6
7 test('accepts a hydrated integrations editor with copy control', () => {
8 assert.equal(isIntegrationsEditorReady(ready), true);
9 });
10 test('does not race ahead when navigation finished but editor is not hydrated', () => {
11 assert.equal(isIntegrationsEditorReady({...ready, editor:false}), false);
12 assert.equal(isIntegrationsEditorReady({...ready, copy:false}), false);
13 });
14 test('rejects a login redirect or another page', () => {
15 assert.equal(isIntegrationsEditorReady({...ready, href:'http://127.0.0.1:3210/login'}), false);
16 });
17 test('rejects an unrelated origin or malformed data', () => {
18 assert.equal(isIntegrationsEditorReady({...ready, href:'https://example.com/integrations'}), false);
19 assert.equal(isIntegrationsEditorReady(null), false);
20 assert.equal(isIntegrationsEditorReady({...ready, href:'not a URL'}), false);
21 });