import extractMentionedUsers from './extractMentionedUsers' const contentWithMentions = '

Something inspirational about @bob-der-baumeister and @jenny-rostock.

' const contentEmptyMentions = '

Something inspirational about @bob-der-baumeister and @jenny-rostock.

' const contentWithPlainLinks = '

Something inspirational about @bob-der-baumeister and @jenny-rostock.

' describe('extractMentionedUsers', () => { describe('content undefined', () => { it('returns empty array', () => { expect(extractMentionedUsers()).toEqual([]) }) }) it('ignores links without .mention class', () => { expect(extractMentionedUsers(contentWithPlainLinks)).toEqual([]) }) describe('given a link with .mention class and `data-mention-id` attribute ', () => { it('extracts ids', () => { expect(extractMentionedUsers(contentWithMentions)).toEqual(['u3']) }) it('ignores empty `data-mention-id` attributes', () => { expect(extractMentionedUsers(contentEmptyMentions)).toEqual([]) }) }) })