HEADER v3, primary аккаунты и подтверждения

This commit is contained in:
AidarKC
2026-11-27 12:29:24 +03:00
parent f9e7c4ef94
commit ae430e84c7
89 changed files with 1201 additions and 1596 deletions
@@ -0,0 +1,15 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import {savePendingHeaderIdentity,readPendingHeaderIdentity,clearPendingHeaderIdentity} from '../js/services/pending-header-identity.js';
test('pending HEADER declaration survives module reload and remains bound to login and key',async()=>{
const m=new Map();globalThis.localStorage={setItem:(k,v)=>m.set(k,v),getItem:k=>m.get(k),removeItem:k=>m.delete(k)};
const declaration={accountType:1,previousAccounts:['Bob@free']};
savePendingHeaderIdentity('Alice@shine','a+/=',declaration);
const fresh=await import('../js/services/pending-header-identity.js?reload');
assert.deepEqual(fresh.readPendingHeaderIdentity('alice@shine','a-_'),declaration);
assert.equal(fresh.readPendingHeaderIdentity('alice@shine','other'),null);
assert.equal(fresh.readPendingHeaderIdentity('bob@shine','a-_'),null);
clearPendingHeaderIdentity('Alice@shine','a+/=');
assert.equal(fresh.readPendingHeaderIdentity('alice@shine','a-_'),null);
delete globalThis.localStorage;
});