修改功能
This commit is contained in:
@@ -18,6 +18,8 @@ function feedbackFixture(overrides) {
|
||||
appUserNickName: '叶子',
|
||||
appUserPhone: '19100000000',
|
||||
feedbackType: 'bug',
|
||||
feedbackTypeLabel: '问题反馈',
|
||||
feedbackTypeOptionState: 'ACTIVE',
|
||||
feedbackContent: '页面按钮无响应',
|
||||
contactInfo: '测试联系方式',
|
||||
handleStatus: '2',
|
||||
@@ -51,23 +53,27 @@ test('反馈请求只构造 AppFeedbackBody 并裁剪文本', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('反馈内容必填且类型只允许后端确认的四种值', () => {
|
||||
test('反馈内容必填且类型只允许后端当前启用的字典值', () => {
|
||||
const allowedTypes = ['advice', 'bug', 'complaint', 'other'];
|
||||
|
||||
assert.equal(FeedbackPages.validateFeedbackBody({ feedbackContent: '建议增加导出' }), '');
|
||||
assert.equal(FeedbackPages.validateFeedbackBody({
|
||||
feedbackType: 'advice',
|
||||
feedbackContent: '建议增加导出'
|
||||
}), '');
|
||||
}, allowedTypes), '');
|
||||
assert.match(FeedbackPages.validateFeedbackBody({ feedbackContent: '' }), /反馈内容/);
|
||||
assert.match(FeedbackPages.validateFeedbackBody({
|
||||
feedbackType: 'suggestion',
|
||||
feedbackContent: '建议增加导出'
|
||||
}), /反馈类型/);
|
||||
}, allowedTypes), /反馈类型/);
|
||||
});
|
||||
|
||||
test('FeedbackVo 只保留用户可见字段并保持长 ID 字符串', () => {
|
||||
assert.deepEqual(FeedbackPages.normalizeFeedback(feedbackFixture()), {
|
||||
feedbackId,
|
||||
feedbackType: 'bug',
|
||||
feedbackTypeLabel: '问题反馈',
|
||||
feedbackTypeOptionState: 'ACTIVE',
|
||||
feedbackContent: '页面按钮无响应',
|
||||
contactInfo: '测试联系方式',
|
||||
handleStatus: '2',
|
||||
@@ -90,6 +96,35 @@ test('FeedbackVo 只保留用户可见字段并保持长 ID 字符串', () => {
|
||||
})), null);
|
||||
});
|
||||
|
||||
test('未知历史反馈类型使用后端标签展示,不影响整批历史记录', () => {
|
||||
const legacyFeedback = feedbackFixture({
|
||||
feedbackType: '功能问题',
|
||||
feedbackTypeLabel: '功能问题',
|
||||
feedbackTypeOptionState: 'UNKNOWN'
|
||||
});
|
||||
const normalized = FeedbackPages.normalizeFeedbackList([
|
||||
feedbackFixture(),
|
||||
legacyFeedback
|
||||
]);
|
||||
|
||||
assert.equal(normalized.length, 2);
|
||||
assert.equal(normalized[1].feedbackType, '功能问题');
|
||||
assert.equal(normalized[1].feedbackTypeLabel, '功能问题');
|
||||
assert.equal(normalized[1].feedbackTypeOptionState, 'UNKNOWN');
|
||||
assert.match(FeedbackPages.renderFeedbackList([legacyFeedback]), /功能问题/);
|
||||
});
|
||||
|
||||
test('反馈类型选项只接受后端当前启用的业务字典项', () => {
|
||||
assert.deepEqual(FeedbackPages.normalizeFeedbackTypeOptions([
|
||||
{ value: 'advice', label: '建议', enabled: true },
|
||||
{ value: 'bug', label: '问题反馈', enabled: true },
|
||||
{ value: 'old', label: '旧类型', enabled: false }
|
||||
]), [
|
||||
{ value: 'advice', label: '建议' },
|
||||
{ value: 'bug', label: '问题反馈' }
|
||||
]);
|
||||
});
|
||||
|
||||
test('反馈数组包含非法记录时整批拒绝', () => {
|
||||
assert.equal(FeedbackPages.normalizeFeedbackList([feedbackFixture()]).length, 1);
|
||||
assert.deepEqual(FeedbackPages.normalizeFeedbackList([
|
||||
@@ -166,6 +201,7 @@ test('我的工单和详情页读取同一反馈集合且不制造处理动作',
|
||||
test('反馈运行时提交后重读同一 ID,详情不存在时不回退', () => {
|
||||
const source = read('public/js/feedback-pages.js');
|
||||
|
||||
assert.match(source, /api\.businessDictionary\('gen_feedback_type'\)/);
|
||||
assert.match(source, /await api\.submitFeedback\(/);
|
||||
assert.match(source, /await api\.myFeedback\(\)/);
|
||||
assert.match(source, /提交后无法读取同一反馈记录/);
|
||||
|
||||
Reference in New Issue
Block a user