Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Miepee committed Nov 1, 2022
1 parent 6a4335c commit f960028
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/matrixeventprocessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export class MatrixEventProcessor {
msg += `invited \`${event.state_key}\` to the room`;
} else if (membership === "leave" && event.state_key !== event.sender && allowKick) {
msg += `kicked \`${event.state_key}\` from the room`;
} else if (membership === "leave" && allowJoinLeave) {
} else if (membership === "leave" && event.state_key === event.sender && allowJoinLeave) {
msg += "left the room";
} else if (membership === "ban" && allowBan) {
msg += `banned \`${event.state_key}\` from the room`;
Expand Down
14 changes: 7 additions & 7 deletions test/test_matrixeventprocessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,9 @@ describe("MatrixEventProcessor", () => {
expect(STATE_EVENT_MSG).to.equal("`@user:localhost` set the name to `Test Name` on Matrix.");
});
it("Should not echo name changes", async () => {
const config = new DiscordBridgeConfig();
config.bridge.disableRoomNameNotifications = true;
const {processor} = createMatrixEventProcessor();
const bridge = new DiscordBridgeConfigBridge();
bridge.disableRoomNameNotifications = true;
const {processor} = createMatrixEventProcessor(0, bridge);
const event = {
content: {
name: "Test Name",
Expand Down Expand Up @@ -453,8 +453,8 @@ describe("MatrixEventProcessor", () => {
expect(STATE_EVENT_MSG).to.equal("`@user:localhost` kicked `@user2:localhost` from the room on Matrix.");
});
it("Should not echo kicks", async () => {
const config = new DiscordBridgeConfig();
config.bridge.disableKickNotifications = true;
const bridge = new DiscordBridgeConfigBridge();
bridge.disableKickNotifications = true;
const {processor} = createMatrixEventProcessor(0, bridge);
const event = {
content: {
Expand Down Expand Up @@ -510,8 +510,8 @@ describe("MatrixEventProcessor", () => {
expect(STATE_EVENT_MSG).to.equal("`@user:localhost` banned `@user2:localhost` from the room on Matrix.");
});
it("Should not echo bans", async () => {
const config = new DiscordBridgeConfig();
config.bridge.disableBanNotifications = true;
const bridge = new DiscordBridgeConfigBridge();
bridge.disableBanNotifications = true;
const {processor} = createMatrixEventProcessor(0, bridge);
const event = {
content: {
Expand Down

0 comments on commit f960028

Please sign in to comment.