42 lines
1.9 KiB
JavaScript
42 lines
1.9 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import { readFile } from 'node:fs/promises';
|
|
import test from 'node:test';
|
|
|
|
const read = (path) => readFile(new URL(path, import.meta.url), 'utf8');
|
|
|
|
test('公司文件按岗位展示可切换的解读、生成状态和可折叠原文依据', async () => {
|
|
const [service, list, detail] = await Promise.all([
|
|
read('../src/services/broadcast.ts'),
|
|
read('../src/pages/user/broadcast/index.vue'),
|
|
read('../src/pages/user/broadcast/detail.vue')
|
|
]);
|
|
|
|
assert.match(service, /export type BroadcastInsightStatus/);
|
|
assert.match(service, /interface BroadcastPerspective/);
|
|
assert.match(service, /defaultPerspectiveCode\?: string/);
|
|
assert.match(service, /perspectives: BroadcastPerspective\[\]/);
|
|
assert.match(service, /normalizeBroadcastAttachment/);
|
|
assert.match(service, /perspectives: Array\.isArray\(attachment\.perspectives\) \? attachment\.perspectives : \[\]/);
|
|
assert.match(service, /insightStatus: attachment\.insightStatus \|\| 'NOT_PROCESSED'/);
|
|
|
|
assert.match(detail, /多岗位解读/);
|
|
assert.match(detail, /defaultPerspectiveCode/);
|
|
assert.match(detail, /selectedPerspective/);
|
|
assert.match(detail, /selectPerspective/);
|
|
assert.match(detail, /原文依据/);
|
|
assert.match(detail, /insightStatus === 'PENDING'/);
|
|
assert.match(detail, /刷新解读/);
|
|
assert.match(detail, /insightStatus === 'PARTIAL'/);
|
|
assert.match(detail, /insightStatus === 'FAILED'/);
|
|
assert.match(detail, /scroll-x/);
|
|
assert.match(detail, /role="group"/);
|
|
assert.match(detail, /aria-pressed/);
|
|
assert.ok(detail.indexOf('attachment-summary') < detail.indexOf('perspective-panel'));
|
|
assert.ok(detail.indexOf('download-button') < detail.indexOf('perspective-panel'));
|
|
assert.ok(detail.indexOf('detail-actions') < detail.indexOf('perspective-panel'));
|
|
|
|
assert.match(list, /定向提醒/);
|
|
assert.doesNotMatch(list, />与我有关</);
|
|
assert.doesNotMatch(detail, />与我有关/);
|
|
});
|