diff --git a/src/feeds/parser.rs b/src/feeds/parser.rs index 1c07f67a..fd473005 100644 --- a/src/feeds/parser.rs +++ b/src/feeds/parser.rs @@ -229,10 +229,12 @@ pub async fn js_read_feed(url: String, options: ReadFeedOptions) -> Result Err(err), + }, + false => { + Err(JsError::new(Status::Unknown, "Feed exceeded maximum size")) } - false => Err(JsError::new(Status::Unknown, "Feed exceeded maximum size")) } - }, + } Err(err) => Err(JsError::new(Status::Unknown, err)), }, StatusCode::NOT_MODIFIED => Ok(FeedResult { diff --git a/tests/IntentUtilsTest.ts b/tests/IntentUtilsTest.ts index 1fcae634..b90ef4f9 100644 --- a/tests/IntentUtilsTest.ts +++ b/tests/IntentUtilsTest.ts @@ -40,7 +40,7 @@ describe("IntentUtils", () => { expect(hasInvited).to.be.true; }); - it("invites the user to the room and joins", () => { + it("should fail if the bot was not invited to the room", () => { const targetIntent = IntentMock.create(SENDER_USER_ID); const matrixClient = MatrixClientMock.create(); diff --git a/tests/config/permissions.ts b/tests/config/permissions.ts index 28d38efc..77e94ee5 100644 --- a/tests/config/permissions.ts +++ b/tests/config/permissions.ts @@ -118,17 +118,35 @@ describe("Config/BridgePermissions", () => { ) ).to.be.false; }); - const checkActorValues = ["@foo:bar", "bar", "*"]; - checkActorValues.forEach(actor => { - it(`will return true for a service defintion of '${actor}' that has a sufficent level`, () => { - const bridgePermissions = genBridgePermissions("@foo:bar", "fake-service", "commands"); - expect( - bridgePermissions.checkActionAny( - "@foo:bar", - "commands" - ) - ).to.be.true; - }); + + it(`will check that a userId actor has a sufficent level`, () => { + const bridgePermissions = genBridgePermissions("@foo:bar", "fake-service", "commands"); + expect( + bridgePermissions.checkActionAny( + "@foo:bar", + "commands" + ) + ).to.be.true; + }); + + it(`will check that a homeserver actor has a sufficent level`, () => { + const bridgePermissions = genBridgePermissions("bar", "fake-service", "commands"); + expect( + bridgePermissions.checkActionAny( + "@foo:bar", + "commands" + ) + ).to.be.true; + }); + + it(`will check that a wildcard actor has a sufficent level`, () => { + const bridgePermissions = genBridgePermissions("*", "fake-service", "commands"); + expect( + bridgePermissions.checkActionAny( + "@foo:bar", + "commands" + ) + ).to.be.true; }); }) }) \ No newline at end of file