Refactor exam information workflow
This commit is contained in:
+12
-1
@@ -67,7 +67,18 @@ try {
|
||||
|
||||
const sqliteFile = await readFile(testDb);
|
||||
assert.equal(sqliteFile.subarray(0, 16).toString(), 'SQLite format 3\0', '测试持久化文件必须是真实 SQLite 数据库');
|
||||
const appSource = await readFile(resolve(root, 'app.js'), 'utf8');
|
||||
const clientSources = await Promise.all([
|
||||
'app.js',
|
||||
'src/client/admin-views.mjs',
|
||||
'src/client/candidate-views.mjs',
|
||||
'src/client/public-views.mjs'
|
||||
].map(file => readFile(resolve(root, file), 'utf8')));
|
||||
const appSource = clientSources.join('\n');
|
||||
for (const modulePath of ['/src/client/api.mjs', '/src/client/ui.mjs', '/src/client/public-views.mjs', '/src/client/candidate-views.mjs', '/src/client/admin-views.mjs']) {
|
||||
const moduleResponse = await anonymous.request(modulePath);
|
||||
assert.equal(moduleResponse.response.status, 200, `${modulePath} 应作为浏览器模块提供`);
|
||||
assert.match(moduleResponse.response.headers.get('content-type') || '', /text\/javascript/, `${modulePath} 应返回 JavaScript MIME 类型`);
|
||||
}
|
||||
assert.doesNotMatch(appSource, /onclick=["']event\.stopPropagation\(\)/, '弹窗不得截断内部按钮的委托点击事件');
|
||||
assert.match(appSource, /data-modal-backdrop/, '弹窗应仅在点击背景层本身时关闭');
|
||||
assert.match(appSource, /data-action="edit-exam"/, '考试草稿应提供编辑入口');
|
||||
|
||||
Reference in New Issue
Block a user