@@ -432,7 +432,7 @@ describe('Bot', function () {
432
432
this . bot . parseText ( message ) . should . equal ( ':in_love:' ) ;
433
433
} ) ;
434
434
435
- it ( 'should convert user mentions from IRC' , function ( ) {
435
+ it ( 'should convert user at- mentions from IRC' , function ( ) {
436
436
const testUser = this . addUser ( { username : 'testuser' , id : '123' } ) ;
437
437
438
438
const username = 'ircuser' ;
@@ -443,7 +443,40 @@ describe('Bot', function () {
443
443
this . sendStub . should . have . been . calledWith ( expected ) ;
444
444
} ) ;
445
445
446
- it ( 'should not convert user mentions from IRC if such user does not exist' , function ( ) {
446
+ it ( 'should convert user colon-initial mentions from IRC' , function ( ) {
447
+ const testUser = this . addUser ( { username : 'testuser' , id : '123' } ) ;
448
+
449
+ const username = 'ircuser' ;
450
+ const text = 'testuser: hello!' ;
451
+ const expected = `**<${ username } >** <@${ testUser . id } > hello!` ;
452
+
453
+ this . bot . sendToDiscord ( username , '#irc' , text ) ;
454
+ this . sendStub . should . have . been . calledWith ( expected ) ;
455
+ } ) ;
456
+
457
+ it ( 'should convert user comma-initial mentions from IRC' , function ( ) {
458
+ const testUser = this . addUser ( { username : 'testuser' , id : '123' } ) ;
459
+
460
+ const username = 'ircuser' ;
461
+ const text = 'testuser, hello!' ;
462
+ const expected = `**<${ username } >** <@${ testUser . id } > hello!` ;
463
+
464
+ this . bot . sendToDiscord ( username , '#irc' , text ) ;
465
+ this . sendStub . should . have . been . calledWith ( expected ) ;
466
+ } ) ;
467
+
468
+ it ( 'should not convert user initial mentions from IRC mid-message' , function ( ) {
469
+ this . addUser ( { username : 'testuser' , id : '123' } ) ;
470
+
471
+ const username = 'ircuser' ;
472
+ const text = 'Hi there testuser, how goes?' ;
473
+ const expected = `**<${ username } >** Hi there testuser, how goes?` ;
474
+
475
+ this . bot . sendToDiscord ( username , '#irc' , text ) ;
476
+ this . sendStub . should . have . been . calledWith ( expected ) ;
477
+ } ) ;
478
+
479
+ it ( 'should not convert user at-mentions from IRC if such user does not exist' , function ( ) {
447
480
const username = 'ircuser' ;
448
481
const text = 'See you there @5pm' ;
449
482
const expected = `**<${ username } >** See you there @5pm` ;
@@ -452,6 +485,15 @@ describe('Bot', function () {
452
485
this . sendStub . should . have . been . calledWith ( expected ) ;
453
486
} ) ;
454
487
488
+ it ( 'should not convert user initial mentions from IRC if such user does not exist' , function ( ) {
489
+ const username = 'ircuser' ;
490
+ const text = 'Agreed, see you then.' ;
491
+ const expected = `**<${ username } >** Agreed, see you then.` ;
492
+
493
+ this . bot . sendToDiscord ( username , '#irc' , text ) ;
494
+ this . sendStub . should . have . been . calledWith ( expected ) ;
495
+ } ) ;
496
+
455
497
it ( 'should convert multiple user mentions from IRC' , function ( ) {
456
498
const testUser = this . addUser ( { username : 'testuser' , id : '123' } ) ;
457
499
const anotherUser = this . addUser ( { username : 'anotheruser' , id : '124' } ) ;
0 commit comments