سامانه صدور فاکتور و حسابداری
test(login): distinguish account identity from tenant hydration timeout without PII
davoodmehraban89 committed
Oct 12, 2026 at 23:37 UTC
260ca88a180ed1472b362d86587e59c26807cf15
1 file changed
+27
scripts/phase0-startup-performance.spec.js
+27
@@ -199,3 +199,30 @@ test('F0 organization-scoped record hydration respects abort and tenant boundary
199
});
200
expect(observed).toEqual({selectedTenant:'org-fixture',preserved:true,noLeakedDummy:true,noStaleSnapshot:true});
201
});
202
+
203
+test('F0 bootstrap timeout reports ACCOUNT_CONTEXT without email, token or private profile',async({page})=>{
204
+ await page.goto(BASE,{waitUntil:'domcontentloaded'});
205
+ await expect.poll(()=>page.evaluate(()=>window.FinoraStartupStatus?.authChecked),{timeout:15000}).toBe(true);
206
+ const output=await page.evaluate(async()=>{
207
+ window.fetchCurrentUser=()=>new Promise(()=>{});
208
+ await enterApp({id:'synthetic-account'}, {timeoutMs:65});
209
+ return document.getElementById('auth-login-status').textContent;
210
+ });
211
+ expect(output).toContain('BOOT_ACCOUNT_CONTEXT');
212
+ expect(output).toContain('بیش از حد');
213
+ expect(output).not.toMatch(/synthetic-account|@|Bearer |password|access_token/i);
214
+});
215
+
216
+test('F0 bootstrap timeout reports TENANT_RECORDS when profile has already resolved',async({page})=>{
217
+ await page.goto(BASE,{waitUntil:'domcontentloaded'});
218
+ await expect.poll(()=>page.evaluate(()=>window.FinoraStartupStatus?.authChecked),{timeout:15000}).toBe(true);
219
+ const output=await page.evaluate(async()=>{
220
+ window.fetchCurrentUser=async()=>({id:'synthetic-tenant',role:'accountant',fullName:'Not Public'});
221
+ window.pullAll=()=>new Promise(()=>{});
222
+ await enterApp({id:'synthetic-tenant'}, {timeoutMs:65});
223
+ return document.getElementById('auth-login-status').textContent;
224
+ });
225
+ expect(output).toContain('BOOT_TENANT_RECORDS');
226
+ expect(output).toContain('بیش از حد');
227
+ expect(output).not.toMatch(/synthetic-tenant|Not Public|Bearer |password|access_token/i);
228
+});