From f7cc67b455a12ccae9b0ea16876d166720364357 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 4 Jan 2019 08:56:20 +0100 Subject: Add new follow, mention and user registered notifs --- server/tests/helpers/comment-model.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 server/tests/helpers/comment-model.ts (limited to 'server/tests/helpers/comment-model.ts') diff --git a/server/tests/helpers/comment-model.ts b/server/tests/helpers/comment-model.ts new file mode 100644 index 000000000..76bb0f212 --- /dev/null +++ b/server/tests/helpers/comment-model.ts @@ -0,0 +1,25 @@ +/* tslint:disable:no-unused-expression */ + +import * as chai from 'chai' +import 'mocha' +import { VideoCommentModel } from '../../models/video/video-comment' + +const expect = chai.expect + +class CommentMock { + text: string + + extractMentions = VideoCommentModel.prototype.extractMentions +} + +describe('Comment model', function () { + it('Should correctly extract mentions', async function () { + const comment = new CommentMock() + + comment.text = '@florian @jean@localhost:9000 @flo @another@localhost:9000 @flo2@jean.com hello ' + + 'email@localhost:9000 coucou.com no? @chocobozzz @chocobozzz @end' + const result = comment.extractMentions().sort() + + expect(result).to.deep.equal([ 'another', 'chocobozzz', 'end', 'flo', 'florian', 'jean' ]) + }) +}) -- cgit v1.2.3