Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
File size: 1,643 Bytes
a8fb296 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | import { describe, expect, it } from 'vitest'
import {
ADMIN_GUIDE_BY_PATH,
DOCS_INTRO,
adminGuideHref,
docsUrl,
} from './docsLinks'
describe('docsUrl', () => {
it('joins the docs base with a rooted path', () => {
const url = docsUrl('/development/ai-policy-analysis')
expect(url.endsWith('/docs/development/ai-policy-analysis')).toBe(true)
expect(url.includes('//docs/')).toBe(false)
})
it('normalizes a path missing the leading slash', () => {
expect(docsUrl('intro')).toBe(docsUrl('/intro'))
})
})
describe('DOCS_INTRO', () => {
it('points at the docs intro page', () => {
expect(DOCS_INTRO).toBe(docsUrl('/intro'))
})
})
describe('ADMIN_GUIDE_BY_PATH / adminGuideHref', () => {
it('maps the three admin screens from the contract', () => {
expect(ADMIN_GUIDE_BY_PATH['/admin/batch-jobs']).toBe(
'/development/ai-policy-analysis',
)
expect(ADMIN_GUIDE_BY_PATH['/admin/meeting-kinds']).toBe(
'/development/jev-meeting-kind-gate',
)
expect(ADMIN_GUIDE_BY_PATH['/admin/application-links']).toBe(
'/development/data-center-application-links',
)
expect(ADMIN_GUIDE_BY_PATH['/admin/lighthouse-report']).toBeUndefined()
})
it('resolves exact and nested admin paths to absolute guide URLs', () => {
expect(adminGuideHref('/admin/batch-jobs')).toBe(
docsUrl('/development/ai-policy-analysis'),
)
expect(adminGuideHref('/admin/batch-jobs/run/abc')).toBe(
docsUrl('/development/ai-policy-analysis'),
)
expect(adminGuideHref('/admin/lighthouse-report')).toBeNull()
expect(adminGuideHref('/settings')).toBeNull()
})
}) |