Skip to content

Commit

Permalink
Fix tests properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Half-Shot committed Jun 3, 2021
1 parent 1af0931 commit cc95dd2
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions spec/integ/room-upgrade.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,17 @@ describe("Room upgrades", function() {
const store = env.ircBridge.getStore();
const newRoomId = "!new_room:bar.com";
env.clientMock._client(botUserId).getStateEvent.and.callFake(async (roomId, eventType, key) => {
if (roomId !== newRoomId) {
throw Error('Wrong room ID');
}
if (eventType !== 'm.room.create') {
throw Error('Wrong event type');
}
if (key && key !== '') {
throw Error('Key should be blank')
if (eventType === 'm.room.create') {
expect(roomId).toEqual(newRoomId);
expect(key).toEqual('');
return {
predecessor: {
room_id: roomMapping.roomId,
}
};
}
return {
predecessor: {
room_id: roomMapping.roomId,
}
};
// Pass through others
return {};
});
await env.mockAppService._trigger("type:m.room.tombstone", {
content: {
Expand Down Expand Up @@ -126,6 +123,9 @@ describe("Room upgrades", function() {
});
});

expect(
env.clientMock._client(botUserId).getStateEvent.calls.any(newRoomId, 'm.room.create', '')
).toBeTrue();
const oldRoom = await store.getRoom(roomMapping.roomId, roomMapping.server, roomMapping.channel);
const newRoom = await store.getRoom(newRoomId, roomMapping.server, roomMapping.channel);
await allLeft;
Expand Down

0 comments on commit cc95dd2

Please sign in to comment.