fix(chat) - graceful for failure and fix link regex (#12225)

* fix(chat) - graceful for failure and fix link regex

* fix(chat) - Adjust unit test to test for the actual functional failure
This commit is contained in:
Bart Enkelaar
2020-05-21 18:00:58 +02:00
committed by GitHub
parent a1ec42c0b2
commit 26f5bf554e
2 changed files with 14 additions and 1 deletions
@@ -149,6 +149,14 @@ describe('highlightMentions', () => {
expect(result[0]).to.equal('[@user](/profile/111) `@user`');
});
it('matches a link in between two the same links', async () => {
const text = '[here](http://habitica.wikia.com/wiki/The_Keep:Pirate_Cove/FAQ)\n@user\n[hier](http://habitica.wikia.com/wiki/The_Keep:Pirate_Cove/FAQ)';
const result = await highlightMentions(text);
expect(result[0]).to.equal('[here](http://habitica.wikia.com/wiki/The_Keep:Pirate_Cove/FAQ)\n[@user](/profile/111)\n[hier](http://habitica.wikia.com/wiki/The_Keep:Pirate_Cove/FAQ)');
});
});
it('github issue 12118, method crashes when square brackets are used', async () => {