mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-20 04:38:55 +00:00
fix failing tests
This commit is contained in:
parent
82863bd947
commit
e9d5123f8a
2 changed files with 12 additions and 13 deletions
|
|
@ -33,32 +33,32 @@ describe('highlightMentions', () => {
|
|||
|
||||
it('doesn\'t change text without mentions', async () => {
|
||||
let text = 'some chat text';
|
||||
let highlightedText = await highlightMentions(text);
|
||||
expect(highlightedText).to.equal(text);
|
||||
let result = await highlightMentions(text);
|
||||
expect(result[0]).to.equal(text);
|
||||
});
|
||||
it('highlights existing users', async () => {
|
||||
let text = '@user: message';
|
||||
let highlightedText = await highlightMentions(text);
|
||||
expect(highlightedText).to.equal('[@user](/profile/111): message');
|
||||
let result = await highlightMentions(text);
|
||||
expect(result[0]).to.equal('[@user](/profile/111): message');
|
||||
});
|
||||
it('highlights special characters', async () => {
|
||||
let text = '@user-dash: message @user_underscore';
|
||||
let highlightedText = await highlightMentions(text);
|
||||
expect(highlightedText).to.equal('[@user-dash](/profile/444): message [@user_underscore](/profile/555)');
|
||||
let result = await highlightMentions(text);
|
||||
expect(result[0]).to.equal('[@user-dash](/profile/444): message [@user_underscore](/profile/555)');
|
||||
});
|
||||
it('doesn\'t highlight nonexisting users', async () => {
|
||||
let text = '@nouser message';
|
||||
let highlightedText = await highlightMentions(text);
|
||||
expect(highlightedText).to.equal('@nouser message');
|
||||
let result = await highlightMentions(text);
|
||||
expect(result[0]).to.equal('@nouser message');
|
||||
});
|
||||
it('highlights multiple existing users', async () => {
|
||||
let text = '@user message (@user2) @user3 @user';
|
||||
let highlightedText = await highlightMentions(text);
|
||||
expect(highlightedText).to.equal('[@user](/profile/111) message ([@user2](/profile/222)) [@user3](/profile/333) [@user](/profile/111)');
|
||||
let result = await highlightMentions(text);
|
||||
expect(result[0]).to.equal('[@user](/profile/111) message ([@user2](/profile/222)) [@user3](/profile/333) [@user](/profile/111)');
|
||||
});
|
||||
it('doesn\'t highlight more than 5 users', async () => {
|
||||
let text = '@user @user2 @user3 @user4 @user5 @user6';
|
||||
let highlightedText = await highlightMentions(text);
|
||||
expect(highlightedText).to.equal(text);
|
||||
let result = await highlightMentions(text);
|
||||
expect(result[0]).to.equal(text);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -85,7 +85,6 @@ function getBannedWordsFromText (message) {
|
|||
}
|
||||
|
||||
|
||||
const mentionRegex = new RegExp('\\B@[-\\w]+', 'g');
|
||||
/**
|
||||
* @api {post} /api/v3/groups/:groupId/chat Post chat message to a group
|
||||
* @apiName PostChat
|
||||
|
|
|
|||
Loading…
Reference in a new issue