diff options
author | Chocobozzz <me@florianbigard.com> | 2023-08-17 08:59:21 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-08-17 08:59:21 +0200 |
commit | c380e3928517eb5311b38cf257816642617d7a33 (patch) | |
tree | 2ea9b70ebca16b5d109bcce98fe7f944dad89319 /packages/tests/src/server-helpers/mentions.ts | |
parent | a8ca6190fb462bf6eb5685cfc1d8ae444164a487 (diff) | |
parent | 3a4992633ee62d5edfbb484d9c6bcb3cf158489d (diff) | |
download | PeerTube-c380e3928517eb5311b38cf257816642617d7a33.tar.gz PeerTube-c380e3928517eb5311b38cf257816642617d7a33.tar.zst PeerTube-c380e3928517eb5311b38cf257816642617d7a33.zip |
Merge branch 'feature/esm-and-nx' into develop
Diffstat (limited to 'packages/tests/src/server-helpers/mentions.ts')
-rw-r--r-- | packages/tests/src/server-helpers/mentions.ts | 17 |
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 | |||
3 | import { expect } from 'chai' | ||
4 | import { extractMentions } from '@peertube/peertube-server/server/helpers/mentions.js' | ||
5 | |||
6 | describe('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 | }) | ||