aboutsummaryrefslogtreecommitdiffhomepage
path: root/packages/tests/src/server-helpers/mentions.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/tests/src/server-helpers/mentions.ts')
-rw-r--r--packages/tests/src/server-helpers/mentions.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/packages/tests/src/server-helpers/mentions.ts b/packages/tests/src/server-helpers/mentions.ts
new file mode 100644
index 000000000..153931d60
--- /dev/null
+++ b/packages/tests/src/server-helpers/mentions.ts
@@ -0,0 +1,17 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2
3import { expect } from 'chai'
4import { extractMentions } from '@peertube/peertube-server/server/helpers/mentions.js'
5
6describe('Comment model', function () {
7 it('Should correctly extract mentions', async function () {
8 const text = '@florian @jean@localhost:9000 @flo @another@localhost:9000 @flo2@jean.com hello ' +
9 'email@localhost:9000 coucou.com no? @chocobozzz @chocobozzz @end'
10
11 const isOwned = true
12
13 const result = extractMentions(text, isOwned).sort((a, b) => a.localeCompare(b))
14
15 expect(result).to.deep.equal([ 'another', 'chocobozzz', 'end', 'flo', 'florian', 'jean' ])
16 })
17})