skillhub/web/src/shared/lib/base-path.test.ts
philsun 34f244e7a4 feat(web): support configurable base-path deployment
Signed-off-by: philsun <xinyi.sun@daocloud.io>
2026-08-05 12:50:26 +08:00

13 lines
600 B
TypeScript

import { describe, expect, it } from 'vitest'
import { toRouterPath } from './base-path'
describe('toRouterPath', () => {
it('removes the deployment base path while preserving search and hash', () => {
expect(toRouterPath('/skillhub/search', '?q=java', '#results', '/skillhub/')).toBe('/search?q=java#results')
})
it('keeps root deployments and unrelated paths unchanged', () => {
expect(toRouterPath('/search', '?q=java', '#results', '/')).toBe('/search?q=java#results')
expect(toRouterPath('/skillhub-admin/search', '', '', '/skillhub/')).toBe('/skillhub-admin/search')
})
})