mirror of
https://github.com/vector-im/element-web.git
synced 2026-05-05 20:26:19 +02:00
Make room names deterministic
So the tests don't fail if you add other tests or run them individually
This commit is contained in:
parent
51499fa106
commit
206905c2f5
@ -89,7 +89,6 @@ describe("RoomView", () => {
|
||||
let cli: MockedObject<MatrixClient>;
|
||||
let room: Room;
|
||||
let rooms: Map<string, Room>;
|
||||
let roomCount = 0;
|
||||
let stores: SdkContextClass;
|
||||
let crypto: CryptoApi;
|
||||
|
||||
@ -100,7 +99,9 @@ describe("RoomView", () => {
|
||||
mockPlatformPeg({ reload: () => {} });
|
||||
cli = mocked(stubClient());
|
||||
|
||||
room = new Room(`!${roomCount++}:example.org`, cli, "@alice:example.org");
|
||||
const roomName = (expect.getState().currentTestName ?? "").replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
|
||||
|
||||
room = new Room(`!${roomName}:example.org`, cli, "@alice:example.org");
|
||||
jest.spyOn(room, "findPredecessor");
|
||||
room.getPendingEvents = () => [];
|
||||
rooms = new Map();
|
||||
@ -725,7 +726,7 @@ describe("RoomView", () => {
|
||||
});
|
||||
|
||||
it("should switch rooms when edit is clicked on a search result for a different room", async () => {
|
||||
const room2 = new Room(`!${roomCount++}:example.org`, cli, "@alice:example.org");
|
||||
const room2 = new Room(`!roomswitchtest:example.org`, cli, "@alice:example.org");
|
||||
rooms.set(room2.roomId, room2);
|
||||
|
||||
room.getMyMembership = jest.fn().mockReturnValue(KnownMembership.Join);
|
||||
|
||||
@ -1099,12 +1099,12 @@ exports[`RoomView invites renders an invite room 1`] = `
|
||||
class="mx_RoomPreviewBar_message"
|
||||
>
|
||||
<h3>
|
||||
Do you want to join !2:example.org?
|
||||
Do you want to join !roomviewinvitesrendersaninviteroom:example.org?
|
||||
</h3>
|
||||
<p>
|
||||
<span
|
||||
class="_avatar_1qbcf_8 mx_BaseAvatar _avatar-imageless_1qbcf_52"
|
||||
data-color="4"
|
||||
data-color="2"
|
||||
data-testid="avatar-img"
|
||||
data-type="round"
|
||||
role="presentation"
|
||||
@ -1185,7 +1185,7 @@ exports[`RoomView should not display the timeline when the room encryption is lo
|
||||
aria-label="Open room settings"
|
||||
aria-live="off"
|
||||
class="_avatar_1qbcf_8 mx_BaseAvatar _avatar-imageless_1qbcf_52"
|
||||
data-color="5"
|
||||
data-color="1"
|
||||
data-testid="avatar-img"
|
||||
data-type="round"
|
||||
role="button"
|
||||
@ -1212,7 +1212,7 @@ exports[`RoomView should not display the timeline when the room encryption is lo
|
||||
<span
|
||||
class="mx_RoomHeader_truncated mx_lineClamp"
|
||||
>
|
||||
!12:example.org
|
||||
!roomviewshouldnotdisplaythetimelinewhentheroomencryptionisloading:example.org
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -1397,7 +1397,7 @@ exports[`RoomView should not display the timeline when the room encryption is lo
|
||||
aria-label="Open room settings"
|
||||
aria-live="off"
|
||||
class="_avatar_1qbcf_8 mx_BaseAvatar _avatar-imageless_1qbcf_52"
|
||||
data-color="5"
|
||||
data-color="1"
|
||||
data-testid="avatar-img"
|
||||
data-type="round"
|
||||
role="button"
|
||||
@ -1424,7 +1424,7 @@ exports[`RoomView should not display the timeline when the room encryption is lo
|
||||
<span
|
||||
class="mx_RoomHeader_truncated mx_lineClamp"
|
||||
>
|
||||
!12:example.org
|
||||
!roomviewshouldnotdisplaythetimelinewhentheroomencryptionisloading:example.org
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -1787,7 +1787,7 @@ exports[`RoomView video rooms should render joined video room view 1`] = `
|
||||
aria-label="Open room settings"
|
||||
aria-live="off"
|
||||
class="_avatar_1qbcf_8 mx_BaseAvatar _avatar-imageless_1qbcf_52"
|
||||
data-color="4"
|
||||
data-color="2"
|
||||
data-testid="avatar-img"
|
||||
data-type="round"
|
||||
role="button"
|
||||
@ -1814,7 +1814,7 @@ exports[`RoomView video rooms should render joined video room view 1`] = `
|
||||
<span
|
||||
class="mx_RoomHeader_truncated mx_lineClamp"
|
||||
>
|
||||
!17:example.org
|
||||
!roomviewvideoroomsshouldrenderjoinedvideoroomview:example.org
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user