@@ -622,6 +622,11 @@ describe("Room", function() {
622
622
} , event : true ,
623
623
} ) ] ) ;
624
624
} ;
625
+ const setAlias = function ( alias ) {
626
+ room . addLiveEvents ( [ utils . mkEvent ( {
627
+ type : "m.room.canonical_alias" , room : roomId , skey : "" , content : { alias } , event : true ,
628
+ } ) ] ) ;
629
+ } ;
625
630
const setRoomName = function ( name ) {
626
631
room . addLiveEvents ( [ utils . mkEvent ( {
627
632
type : "m.room.name" , room : roomId , user : userA , content : {
@@ -857,7 +862,7 @@ describe("Room", function() {
857
862
"(invite join_rules) rooms if a room name doesn't exist." , function ( ) {
858
863
const alias = "#room_alias:here" ;
859
864
setJoinRule ( "invite" ) ;
860
- setAltAliases ( [ alias , "#another:here" ] ) ;
865
+ setAlias ( alias ) ;
861
866
room . recalculate ( ) ;
862
867
const name = room . name ;
863
868
expect ( name ) . toEqual ( alias ) ;
@@ -867,12 +872,20 @@ describe("Room", function() {
867
872
"(public join_rules) rooms if a room name doesn't exist." , function ( ) {
868
873
const alias = "#room_alias:here" ;
869
874
setJoinRule ( "public" ) ;
870
- setAltAliases ( [ alias , "#another:here" ] ) ;
875
+ setAlias ( alias ) ;
871
876
room . recalculate ( ) ;
872
877
const name = room . name ;
873
878
expect ( name ) . toEqual ( alias ) ;
874
879
} ) ;
875
880
881
+ it ( "should not show alt aliases if a room name does not exist" , ( ) => {
882
+ const alias = "#room_alias:here" ;
883
+ setAltAliases ( [ alias , "#another:here" ] ) ;
884
+ room . recalculate ( ) ;
885
+ const name = room . name ;
886
+ expect ( name ) . not . toEqual ( alias ) ;
887
+ } ) ;
888
+
876
889
it ( "should show the room name if one exists for private " +
877
890
"(invite join_rules) rooms." , function ( ) {
878
891
const roomName = "A mighty name indeed" ;
0 commit comments