ts-mocha has also been updated to make running locally possible (else it gives a confusing error that tsconfig.json is not "json" or the likes)
This commit is contained in:
Jonathan de Jong 2022-05-03 12:20:40 +02:00 committed by GitHub
parent 3d10f998b7
commit cc9f393ed7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 8 deletions

View File

@ -30,7 +30,7 @@
"eslint": "^7.32", "eslint": "^7.32",
"expect": "^27.0.6", "expect": "^27.0.6",
"mocha": "^9.0.1", "mocha": "^9.0.1",
"ts-mocha": "^8.0.0", "ts-mocha": "^9.0.2",
"tslint": "^6.1.3", "tslint": "^6.1.3",
"typescript": "^4.3.5", "typescript": "^4.3.5",
"typescript-formatter": "^7.2" "typescript-formatter": "^7.2"

View File

@ -30,7 +30,7 @@ describe("Test: The make admin command", function () {
await moderator.joinRoom(config.managementRoom); await moderator.joinRoom(config.managementRoom);
LogService.debug("makeadminTest", `Joining managementRoom: ${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}`); LogService.debug("makeadminTest", `moderator creating targetRoom: ${targetRoom}; and inviting ${mjolnirUserId}`);
await moderator.sendMessage(this.mjolnir.managementRoomId, { msgtype: 'm.text.', body: `!mjolnir rooms add ${targetRoom}` }); await moderator.sendMessage(this.mjolnir.managementRoomId, { msgtype: 'm.text.', body: `!mjolnir rooms add ${targetRoom}` });
LogService.debug("makeadminTest", `Adding targetRoom: ${targetRoom}`); LogService.debug("makeadminTest", `Adding targetRoom: ${targetRoom}`);
@ -90,7 +90,7 @@ describe("Test: The make admin command", function () {
try { try {
await moderator.start(); await moderator.start();
powerLevels = await userA.getRoomStateEvent(targetRoom, "m.room.power_levels", ""); 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 () => { await getFirstReaction(mjolnir, this.mjolnir.managementRoomId, '✅', async () => {
LogService.debug("makeadminTest", `Sending: !mjolnir make admin ${targetRoom} ${userBId}`); 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}` }); return await moderator.sendMessage(this.mjolnir.managementRoomId, { msgtype: 'm.text', body: `!mjolnir make admin ${targetRoom} ${userBId}` });

View File

@ -258,6 +258,7 @@ describe("Test: Testing RoomMemberManager", function() {
// Setup a moderator. // Setup a moderator.
this.moderator = await newTestUser({ name: { contains: "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); await this.moderator.joinRoom(this.mjolnir.managementRoomId);
// Create a few users and two rooms. // Create a few users and two rooms.
@ -272,9 +273,11 @@ describe("Test: Testing RoomMemberManager", function() {
} }
const roomId1 = await this.moderator.createRoom({ const roomId1 = await this.moderator.createRoom({
invite: userIds, invite: userIds,
preset: "public_chat",
}); });
const roomId2 = await this.moderator.createRoom({ const roomId2 = await this.moderator.createRoom({
invite: userIds, invite: userIds,
preset: "public_chat",
}); });
const roomIds = [roomId1, roomId2]; const roomIds = [roomId1, roomId2];

View File

@ -114,7 +114,7 @@ describe("Test: standard consequences", function() {
it("Mjolnir doesn't ban a good user", async function() { it("Mjolnir doesn't ban a good user", async function() {
this.timeout(20000); 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 badUser.joinRoom(protectedRoomId);
await goodUser.joinRoom(protectedRoomId); await goodUser.joinRoom(protectedRoomId);
await this.mjolnir.addProtectedRoom(protectedRoomId); await this.mjolnir.addProtectedRoom(protectedRoomId);

View File

@ -2757,10 +2757,10 @@ tr46@^2.1.0:
dependencies: dependencies:
punycode "^2.1.1" punycode "^2.1.1"
ts-mocha@^8.0.0: ts-mocha@^9.0.2:
version "8.0.0" version "9.0.2"
resolved "https://registry.yarnpkg.com/ts-mocha/-/ts-mocha-8.0.0.tgz#962d0fa12eeb6468aa1a6b594bb3bbc818da3ef0" resolved "https://registry.yarnpkg.com/ts-mocha/-/ts-mocha-9.0.2.tgz#c1ef0248874d04a0f26dd9bd8d88e617a8d82ab1"
integrity sha512-Kou1yxTlubLnD5C3unlCVO7nh0HERTezjoVhVw/M5S1SqoUec0WgllQvPk3vzPMc6by8m6xD1uR1yRf8lnVUbA== integrity sha512-WyQjvnzwrrubl0JT7EC1yWmNpcsU3fOuBFfdps30zbmFBgKniSaSOyZMZx+Wq7kytUs5CY+pEbSYEbGfIKnXTw==
dependencies: dependencies:
ts-node "7.0.1" ts-node "7.0.1"
optionalDependencies: optionalDependencies: