import { test } from 'node:test'; import assert from 'node:assert/strict'; import { lotusLinkBases, lotusShareBase } from './useLotusLinkBase'; const LOCAL = 'http://localhost:44548/#/'; const WEB = 'https://chat.lotusguild.org'; test('web: shared links use the page origin', () => { assert.equal(lotusShareBase(WEB, false, WEB), WEB); assert.deepEqual(lotusLinkBases(WEB, false, undefined), [WEB]); }); test('desktop with webAppUrl: shared links use the public web app', () => { assert.equal(lotusShareBase(LOCAL, true, `${WEB}/`), WEB); assert.deepEqual(lotusLinkBases(LOCAL, true, WEB), [LOCAL, WEB]); }); test('desktop without a valid webAppUrl falls back to the origin', () => { [undefined, '', 'http://chat.lotusguild.org', 'nonsense'].forEach((v) => { assert.equal(lotusShareBase(LOCAL, true, v), LOCAL, String(v)); assert.deepEqual(lotusLinkBases(LOCAL, true, v), [LOCAL]); }); });