Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some preset: public_chat / user invites in tests (to fix CI) #282

Merged
merged 1 commit into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"eslint": "^7.32",
"expect": "^27.0.6",
"mocha": "^9.0.1",
"ts-mocha": "^8.0.0",
"ts-mocha": "^9.0.2",
"tslint": "^6.1.3",
"typescript": "^4.3.5",
"typescript-formatter": "^7.2"
Expand Down
4 changes: 2 additions & 2 deletions test/integration/commands/makedminCommandTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("Test: The make admin command", function () {

await moderator.joinRoom(config.managementRoom);
LogService.debug("makeadminTest", `Joining managementRoom: ${config.managementRoom}`);
let targetRoom = await moderator.createRoom({ invite: [mjolnirUserId] });
let targetRoom = await moderator.createRoom({ invite: [mjolnirUserId], preset: "public_chat" });
LogService.debug("makeadminTest", `moderator creating targetRoom: ${targetRoom}; and inviting ${mjolnirUserId}`);
await moderator.sendMessage(this.mjolnir.managementRoomId, { msgtype: 'm.text.', body: `!mjolnir rooms add ${targetRoom}` });
LogService.debug("makeadminTest", `Adding targetRoom: ${targetRoom}`);
Expand Down Expand Up @@ -90,7 +90,7 @@ describe("Test: The make admin command", function () {
try {
await moderator.start();
powerLevels = await userA.getRoomStateEvent(targetRoom, "m.room.power_levels", "");
assert.notEqual(powerLevels["users"][userBId], 100, `User B should not yet be an admin of ${targetRoom}`);
assert.notEqual(powerLevels["users"][userBId], 100, `User B should not yet be an admin of ${targetRoom}`);
await getFirstReaction(mjolnir, this.mjolnir.managementRoomId, '✅', async () => {
LogService.debug("makeadminTest", `Sending: !mjolnir make admin ${targetRoom} ${userBId}`);
return await moderator.sendMessage(this.mjolnir.managementRoomId, { msgtype: 'm.text', body: `!mjolnir make admin ${targetRoom} ${userBId}` });
Expand Down
3 changes: 3 additions & 0 deletions test/integration/roomMembersTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ describe("Test: Testing RoomMemberManager", function() {

// Setup a moderator.
this.moderator = await newTestUser({ name: { contains: "moderator" } });
await this.mjolnir.client.inviteUser(await this.moderator.getUserId(), this.mjolnir.managementRoomId)
await this.moderator.joinRoom(this.mjolnir.managementRoomId);

// Create a few users and two rooms.
Expand All @@ -272,9 +273,11 @@ describe("Test: Testing RoomMemberManager", function() {
}
const roomId1 = await this.moderator.createRoom({
invite: userIds,
preset: "public_chat",
});
const roomId2 = await this.moderator.createRoom({
invite: userIds,
preset: "public_chat",
});
const roomIds = [roomId1, roomId2];

Expand Down
2 changes: 1 addition & 1 deletion test/integration/standardConsequenceTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ describe("Test: standard consequences", function() {
it("Mjolnir doesn't ban a good user", async function() {
this.timeout(20000);

let protectedRoomId = await this.mjolnir.client.createRoom({ invite: [await goodUser.getUserId()] });
let protectedRoomId = await this.mjolnir.client.createRoom({ invite: [await goodUser.getUserId(), await badUser.getUserId()] });
await badUser.joinRoom(protectedRoomId);
await goodUser.joinRoom(protectedRoomId);
await this.mjolnir.addProtectedRoom(protectedRoomId);
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2757,10 +2757,10 @@ tr46@^2.1.0:
dependencies:
punycode "^2.1.1"

ts-mocha@^8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/ts-mocha/-/ts-mocha-8.0.0.tgz#962d0fa12eeb6468aa1a6b594bb3bbc818da3ef0"
integrity sha512-Kou1yxTlubLnD5C3unlCVO7nh0HERTezjoVhVw/M5S1SqoUec0WgllQvPk3vzPMc6by8m6xD1uR1yRf8lnVUbA==
ts-mocha@^9.0.2:
version "9.0.2"
resolved "https://registry.yarnpkg.com/ts-mocha/-/ts-mocha-9.0.2.tgz#c1ef0248874d04a0f26dd9bd8d88e617a8d82ab1"
integrity sha512-WyQjvnzwrrubl0JT7EC1yWmNpcsU3fOuBFfdps30zbmFBgKniSaSOyZMZx+Wq7kytUs5CY+pEbSYEbGfIKnXTw==
dependencies:
ts-node "7.0.1"
optionalDependencies:
Expand Down