// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import assert from 'assert'; import * as TextFormatting from 'utils/text_formatting.jsx'; describe('TextFormatting.ChannelLinks', () => { it('Not channel links', (done) => { assert.equal( TextFormatting.formatText('~123').trim(), '

~123

' ); assert.equal( TextFormatting.formatText('~town-square').trim(), '

~town-square

' ); done(); }); it('Channel links', (done) => { assert.equal( TextFormatting.formatText('~town-square', { channelNamesMap: {'town-square': {display_name: 'Town Square'}}, team: {name: 'myteam'} }).trim(), '

~Town Square

' ); assert.equal( TextFormatting.formatText('~town-square.', { channelNamesMap: {'town-square': {display_name: 'Town Square'}}, team: {name: 'myteam'} }).trim(), '

~Town Square.

' ); assert.equal( TextFormatting.formatText('~town-square', { channelNamesMap: {'town-square': {display_name: 'Reception'}}, team: {name: 'myteam'} }).trim(), '

~<b>Reception</b>

' ); done(); }); });