2026-05-05 11:29:18 -04:00
|
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
|
import { NEW_TAB_APPS, resolveAppUrl } from '../appSessionConfig'
|
2026-06-11 00:24:40 -04:00
|
|
|
import { GENERATED_NEW_TAB_APPS } from '../generatedAppSessionConfig'
|
2026-05-05 11:29:18 -04:00
|
|
|
|
|
|
|
|
describe('appSessionConfig', () => {
|
2026-06-11 00:24:40 -04:00
|
|
|
it('keeps manifest-owned new-tab apps marked on every viewport', () => {
|
2026-05-05 11:29:18 -04:00
|
|
|
expect(NEW_TAB_APPS.has('btcpay-server')).toBe(true)
|
2026-06-11 00:24:40 -04:00
|
|
|
expect(NEW_TAB_APPS.has('photoprism')).toBe(true)
|
|
|
|
|
expect(GENERATED_NEW_TAB_APPS.has('photoprism')).toBe(true)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('keeps frontend-only new-tab overrides for apps without generated metadata', () => {
|
|
|
|
|
expect(NEW_TAB_APPS.has('tailscale')).toBe(true)
|
|
|
|
|
expect(GENERATED_NEW_TAB_APPS.has('tailscale')).toBe(false)
|
2026-05-05 11:29:18 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('resolves direct app ports against the current browser host', () => {
|
|
|
|
|
Object.defineProperty(window, 'location', {
|
|
|
|
|
value: { hostname: '192.168.1.228' },
|
|
|
|
|
writable: true,
|
|
|
|
|
configurable: true,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
expect(resolveAppUrl('mempool')).toBe('http://192.168.1.228:4080')
|
|
|
|
|
expect(resolveAppUrl('indeedhub')).toBe('http://192.168.1.228:7778')
|
2026-06-11 00:24:40 -04:00
|
|
|
expect(resolveAppUrl('botfights')).toBe('http://192.168.1.228:9100')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('uses manifest-generated launch ports for apps outside the manual override list', () => {
|
|
|
|
|
Object.defineProperty(window, 'location', {
|
|
|
|
|
value: { hostname: '192.168.1.228' },
|
|
|
|
|
writable: true,
|
|
|
|
|
configurable: true,
|
|
|
|
|
})
|
|
|
|
|
|
2026-07-21 06:59:47 -04:00
|
|
|
// did-wallet's manifest publishes host port 8088 (apps/did-wallet/
|
|
|
|
|
// manifest.yml) — assert against the manifest-generated value, which is
|
|
|
|
|
// exactly what this test exists to protect.
|
|
|
|
|
expect(resolveAppUrl('did-wallet')).toBe('http://192.168.1.228:8088')
|
2026-06-11 00:52:16 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('does not treat service-only tcp ports as web launch surfaces', () => {
|
|
|
|
|
Object.defineProperty(window, 'location', {
|
|
|
|
|
value: { hostname: '192.168.1.228' },
|
|
|
|
|
writable: true,
|
|
|
|
|
configurable: true,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
expect(resolveAppUrl('meshtastic')).toBe('')
|
2026-05-05 11:29:18 -04:00
|
|
|
})
|
2026-05-20 20:38:52 -04:00
|
|
|
|
|
|
|
|
it('keeps NetBird on the unified dashboard proxy port', () => {
|
|
|
|
|
Object.defineProperty(window, 'location', {
|
|
|
|
|
value: { hostname: '192.168.1.228' },
|
|
|
|
|
writable: true,
|
|
|
|
|
configurable: true,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
expect(resolveAppUrl('netbird', undefined, 'http://localhost:8086')).toBe('http://192.168.1.228:8087')
|
|
|
|
|
})
|
2026-06-11 00:24:40 -04:00
|
|
|
|
|
|
|
|
it('uses backend runtime URLs for apps with dynamic launch surfaces', () => {
|
|
|
|
|
Object.defineProperty(window, 'location', {
|
|
|
|
|
value: { hostname: '192.168.1.228' },
|
|
|
|
|
writable: true,
|
|
|
|
|
configurable: true,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
expect(resolveAppUrl('filebrowser', undefined, 'http://localhost:18083')).toBe('http://192.168.1.228:18083')
|
|
|
|
|
})
|
2026-05-05 11:29:18 -04:00
|
|
|
})
|