59 lines
2.5 KiB
TypeScript
59 lines
2.5 KiB
TypeScript
import test from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { readSource } from './helpers.ts'
|
|
import { normalizeImageVideoFilter } from '../src/pages/tasks/image-video-filter.ts'
|
|
|
|
// module 13 task 265:视频任务筛选/批量打包/权限配置对齐。
|
|
|
|
test('test_task_265_filter_normal_primary_path', () => {
|
|
const page = readSource('src/pages/tasks/ImageVideoTasksPage.vue')
|
|
assert.match(page, /用户名(模糊搜索)/, '需用户名模糊筛选')
|
|
assert.match(page, /提交时间/, '需提交时间范围')
|
|
assert.match(page, /查询/, '需查询按钮')
|
|
assert.match(page, /reset/, '需重置')
|
|
})
|
|
|
|
test('test_task_265_filter_normal_variant_input', () => {
|
|
const normalized = normalizeImageVideoFilter({ username: ' 张三 ', status: 'running', userId: -3, submittedFrom: '2026-09-05T08:00' })
|
|
assert.equal(normalized.username, '张三')
|
|
assert.equal(normalized.status, 'RUNNING')
|
|
assert.equal(normalized.userId, null)
|
|
assert.equal(normalized.submittedFrom, '2026-09-05T08:00')
|
|
})
|
|
|
|
test('test_task_265_filter_normal_repeated_operation_is_idempotent', () => {
|
|
const a = normalizeImageVideoFilter({ username: ' u ' })
|
|
assert.equal(normalizeImageVideoFilter(a).username, 'u')
|
|
})
|
|
|
|
test('test_task_265_batch_normal_primary_path', () => {
|
|
const page = readSource('src/pages/tasks/ImageVideoTasksPage.vue')
|
|
assert.match(page, /全选当前页/, '全选当前页勾选')
|
|
assert.match(page, /批量下载/, '批量下载按钮')
|
|
assert.match(page, /requestVideoZipDownload/, '批量走打包端点')
|
|
})
|
|
|
|
test('test_task_265_batch_boundary_empty_input', () => {
|
|
const page = readSource('src/pages/tasks/ImageVideoTasksPage.vue')
|
|
assert.match(page, /请先勾选/, '未勾选给提示')
|
|
})
|
|
|
|
test('test_task_265_permission_normal_primary_path', () => {
|
|
const page = readSource('src/pages/tasks/ImageVideoTasksPage.vue')
|
|
assert.match(page, /权限配置/, '权限入口')
|
|
assert.match(page, /fetchImageVideoPermissionUsers/, '权限用户加载')
|
|
assert.match(page, /saveImageVideoPermissions/, '权限保存')
|
|
assert.match(page, /数据范围授权/, '权限弹窗语义')
|
|
})
|
|
|
|
test('test_task_265_permission_boundary_limit_or_missing_field', () => {
|
|
const page = readSource('src/pages/tasks/ImageVideoTasksPage.vue')
|
|
assert.match(page, /已授权/, '已授权人数展示')
|
|
})
|
|
|
|
test('test_task_265_dependency_failure_returns_actionable_message', () => {
|
|
const api = readSource('src/pages/tasks/image-video-api.ts')
|
|
assert.match(api, /\/download-zip/)
|
|
assert.match(api, /\/api\/admin\/image-video-task-permissions/)
|
|
})
|