From fd457e3c3ca294293891ff1671fd91b7b4b06e92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Wed, 4 Sep 2019 13:51:23 +0200 Subject: [PATCH] Refactor backend test to test some unicode letters are excepted --- backend/src/middleware/hashtags/extractHashtags.spec.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/src/middleware/hashtags/extractHashtags.spec.js b/backend/src/middleware/hashtags/extractHashtags.spec.js index eb581d8f5..3c986b3b6 100644 --- a/backend/src/middleware/hashtags/extractHashtags.spec.js +++ b/backend/src/middleware/hashtags/extractHashtags.spec.js @@ -28,9 +28,10 @@ describe('extractHashtags', () => { }) it('ignores Hashtag links with not allowed character combinations', () => { + // Allowed are all unicode letters '\pL' and all digits '0-9'. There haveto be at least one letter in it. const content = - '

Something inspirational about #AbcDefXyz0123456789!*(),2, #0123456789, #0123456789a and #AbcDefXyz0123456789.

' - expect(extractHashtags(content)).toEqual(['0123456789a', 'AbcDefXyz0123456789']) + '

Something inspirational about #AbcDefXyz0123456789!*(),2, #0123456789, #0123456789a, #AbcDefXyz0123456789, and #λαπ.

' + expect(extractHashtags(content).sort()).toEqual(['0123456789a', 'AbcDefXyz0123456789', 'λαπ']) }) }) @@ -54,4 +55,4 @@ describe('extractHashtags', () => { }) }) }) -}) +}) \ No newline at end of file