feat(v2.7): 接入协作治理前端体验
This commit is contained in:
20
apps/web/lib/comment-mentions.test.ts
Normal file
20
apps/web/lib/comment-mentions.test.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { extractMentionNames, mergeMentionMemberIds } from './comment-mentions';
|
||||
|
||||
test('extractMentionNames reads @memberName mentions from comment content', () => {
|
||||
assert.deepEqual(extractMentionNames('请 @Alice 和 @张三 看一下'), ['Alice', '张三']);
|
||||
});
|
||||
|
||||
test('mergeMentionMemberIds keeps text mention matches before explicit selection and dedupes', () => {
|
||||
const ids = mergeMentionMemberIds({
|
||||
content: '请 @Alice 看一下',
|
||||
explicitMemberIds: ['m-bob', 'm-alice'],
|
||||
members: [
|
||||
{ id: 'm-alice', name: 'Alice' },
|
||||
{ id: 'm-bob', name: 'Bob' },
|
||||
],
|
||||
});
|
||||
|
||||
assert.deepEqual(ids, ['m-alice', 'm-bob']);
|
||||
});
|
||||
Reference in New Issue
Block a user