app

Local-first trade for farms and co-ops
git clone https://radroots.dev/git/app.git
Log | Files | Refs | README | LICENSE

inbox-setup-view.test.ts (863B)


      1 import test from 'node:test';
      2 import assert from 'node:assert/strict';
      3 import {
      4   createInboxSetupView,
      5   inboxSetupViewSnapshot
      6 } from '../../src/lib/messaging/inbox-setup-view.ts';
      7 import { createIdentitySession } from '../../src/lib/runtime/identity-session.ts';
      8 import { deploymentRelayPolicy } from '../../src/lib/config/deployment-relays.ts';
      9 await test('SSR setup construction acquires no browser identity, storage or network', () => {
     10   assert.equal(typeof window, 'undefined');
     11   let lookups = 0;
     12   const view = createInboxSetupView({
     13     identity: createIdentitySession(),
     14     policy: deploymentRelayPolicy,
     15     lookup: () => {
     16       lookups++;
     17       return Promise.reject(new Error('SSR lookup forbidden'));
     18     }
     19   });
     20   assert.equal(view, undefined);
     21   assert.equal(lookups, 0);
     22   assert.equal(inboxSetupViewSnapshot(view).setupComplete, false);
     23 });