Files
Aether/frontend/src/views/admin/__tests__/ProviderManagement.lazy-detail-drawer.spec.ts
T

29 lines
917 B
TypeScript

import { readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import { describe, expect, it } from 'vitest'
const source = readFileSync(
resolve(process.cwd(), 'src/views/admin/ProviderManagement.vue'),
'utf8',
)
describe('ProviderManagement detail drawer loading', () => {
it('keeps the heavy detail drawer out of the initial route chunk', () => {
expect(source).not.toContain(
"import ProviderDetailDrawer from '@/features/providers/components/ProviderDetailDrawer.vue'",
)
expect(source).toContain(
"() => import('@/features/providers/components/ProviderDetailDrawer.vue')",
)
})
it('does not resolve the async drawer until it is opened', () => {
const drawerTemplate = source
.split('<ProviderDetailDrawer')[1]
?.split('/>')[0]
expect(drawerTemplate).toBeTruthy()
expect(drawerTemplate).toContain('v-if="providerDrawerOpen"')
})
})