23 lines
934 B
TypeScript
23 lines
934 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { toDashboardAppPath, toPublicDashboardPath } from './dashboardPaths'
|
|
|
|
describe('dashboard path normalization', () => {
|
|
it('collapses empty and root values to the app root', () => {
|
|
expect(toDashboardAppPath()).toBe('/')
|
|
expect(toDashboardAppPath('')).toBe('/')
|
|
expect(toDashboardAppPath('/')).toBe('/')
|
|
})
|
|
|
|
it('strips repeated dashboard base prefixes', () => {
|
|
expect(toDashboardAppPath('/dashboard')).toBe('/')
|
|
expect(toDashboardAppPath('/dashboard/fleet')).toBe('/fleet')
|
|
expect(toDashboardAppPath('/dashboard/dashboard/reservations')).toBe('/reservations')
|
|
})
|
|
|
|
it('adds the public deployment prefix exactly once', () => {
|
|
expect(toPublicDashboardPath('/')).toBe('/dashboard')
|
|
expect(toPublicDashboardPath('/dashboard/fleet')).toBe('/dashboard/fleet')
|
|
expect(toPublicDashboardPath('customers')).toBe('/dashboard/customers')
|
|
})
|
|
})
|