← Public packages
@kody/mailroom
Offline-first PWA for your Kody mailbox: sent and received threads, copy-prompt for agents, no send.
src/ui/app-url.node.test.ts
29 lines · 898 B · TypeScriptimport assert from 'node:assert/strict'
import test from 'node:test'
import {
needsCanonicalAppRedirect,
numberParam,
resolveAppUrl,
serviceWorkerAllowedPath,
shouldCanonicalizeClientPath,
} from './app-url.ts'
test('app URLs stay under the package mount', () => {
assert.equal(
resolveAppUrl(
'/packages/mailroom/',
'api/threads',
'https://kody.kody.run',
),
'https://kody.kody.run/packages/mailroom/api/threads',
)
assert.equal(needsCanonicalAppRedirect('/packages/mailroom', '/packages/mailroom'), true)
assert.equal(shouldCanonicalizeClientPath('/packages/mailroom'), true)
assert.equal(serviceWorkerAllowedPath('/packages/mailroom/'), '/packages/mailroom')
})
test('missing query ints keep their fallback instead of becoming 0', () => {
assert.equal(numberParam(null, 100), 100)
assert.equal(numberParam('', 100), 100)
assert.equal(numberParam('19', 100), 19)
})