feat: 更新贡献内容服务,增强自动运行通知逻辑和测试用例

This commit is contained in:
QLHazycoder
2026-04-26 06:51:24 +00:00
parent b520711b0a
commit 13d17aa11d
5 changed files with 73 additions and 81 deletions
@@ -86,3 +86,36 @@ test('getContributionUpdateHintMessage returns questionnaire prompt alone when o
assert.equal(message, '有新的征求意见,请佬友共同参与选择。');
});
test('getContributionUpdateHintMessage uses managed auto run notice text when available', () => {
const message = api.getContributionUpdateHintMessage({
promptVersion: 'auto_run_notice:2026-04-23T00:00:01Z',
items: [
{
slug: 'auto_run_notice',
isVisible: true,
text: '公告和使用教程更新了,可点上方“贡献/使用教程”查看。',
},
{ slug: 'announcement', isVisible: true },
{ slug: 'questionnaire', isVisible: true },
],
});
assert.equal(message, '公告和使用教程更新了,可点上方“贡献/使用教程”查看。');
});
test('getContributionUpdateHintMessage suppresses managed auto run notice when it is disabled', () => {
const message = api.getContributionUpdateHintMessage({
promptVersion: 'announcement:2026-04-23T00:00:00Z',
items: [
{
slug: 'auto_run_notice',
isVisible: false,
text: '公告和使用教程更新了,可点上方“贡献/使用教程”查看。',
},
{ slug: 'announcement', isVisible: true },
],
});
assert.equal(message, '');
});