diff --git a/backend/src/middleware/notifications/mentions.spec.js b/backend/src/middleware/notifications/mentions.spec.js index f12df7f07..3e70514b7 100644 --- a/backend/src/middleware/notifications/mentions.spec.js +++ b/backend/src/middleware/notifications/mentions.spec.js @@ -1,30 +1,18 @@ import { extractSlugs } from './mentions' describe('extract', () => { - describe('finds mentions in the form of', () => { - it('@user', () => { - const content = 'Hello @user' - expect(extractSlugs(content)).toEqual(['user']) + describe('searches through links', () => { + it('ignores links without .mention class', () => { + const content = '
Something inspirational about @bob-der-baumeister and @jenny-rostock.
' + expect(extractSlugs(content)).toEqual([]) }) - it('@user-with-dash', () => { - const content = 'Hello @user-with-dash' - expect(extractSlugs(content)).toEqual(['user-with-dash']) - }) + describe('given a link with .mention class', () => { + const content = 'Something inspirational about @bob-der-baumeister and @jenny-rostock.
' - it('@user.', () => { - const content = 'Hello @user.' - expect(extractSlugs(content)).toEqual(['user']) + it('extracts ID', () => { + expect(extractSlugs(content)).toEqual(['u2', 'u3']) + }) }) - - it('@user-With-Capital-LETTERS', () => { - const content = 'Hello @user-With-Capital-LETTERS' - expect(extractSlugs(content)).toEqual(['user-With-Capital-LETTERS']) - }) - }) - - it('ignores email addresses', () => { - const content = 'Hello somebody@example.org' - expect(extractSlugs(content)).toEqual([]) }) })