36 lines
1.7 KiB
TypeScript
36 lines
1.7 KiB
TypeScript
import { readFileSync } from 'node:fs'
|
|
import { resolve } from 'node:path'
|
|
import { describe, expect, it } from 'vitest'
|
|
import { pdaReleaseRoutes } from '../routes'
|
|
import { adminNavigation } from '@/core/navigation/adminNavigation'
|
|
|
|
const page = readFileSync(resolve(process.cwd(), 'src/modules/pda-releases/pages/PdaReleasesView.vue'), 'utf8')
|
|
|
|
describe('PDA release workbench', () => {
|
|
it('registers one permission-gated route and a system menu entry', () => {
|
|
expect(pdaReleaseRoutes[0]?.meta?.permission).toBe('platform:pda-release:list')
|
|
const system = adminNavigation.find((item) => item.key === 'system')
|
|
expect(system?.children?.find((item) => item.key === 'pda-releases')).toMatchObject({
|
|
path: '/system/pda-releases', permission: 'platform:pda-release:list',
|
|
})
|
|
})
|
|
|
|
it('provides separate apps, an APK download and manage-only upload/publish/withdraw controls', () => {
|
|
expect(page).toContain('value="domestic"')
|
|
expect(page).toContain('value="overseas"')
|
|
expect(page).toContain('row.packageType === \'apk\' && row.downloadUrl')
|
|
expect(page).toContain('v-if="canManage"')
|
|
expect(page).toContain('row.status === \'DRAFT\'')
|
|
expect(page).toContain('row.current')
|
|
expect(page).toContain('ElMessageBox.confirm')
|
|
})
|
|
|
|
it('uses the standard dense list workspace without repeating the route title', () => {
|
|
expect(page).toContain('class="surface-panel table-panel pda-release-panel"')
|
|
expect(page).toContain('<template #toolbar-start>')
|
|
expect(page).toContain('<template #toolbar-actions>')
|
|
expect(page).toContain('class="pda-release-actions density-actions"')
|
|
expect(page).not.toContain('<h1>PDA版本</h1>')
|
|
})
|
|
})
|