Skip to content

Commit

Permalink
WIP: feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoric committed Nov 15, 2022
1 parent f1720dd commit 6ee94d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
9 changes: 4 additions & 5 deletions test/integration/policyConsumptionTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,23 @@ import { createBanList, getFirstReaction } from "./commands/commandUtils";
* Get a copy of the rules from the ruleserver.
*/
async function currentRules(mjolnir: Mjolnir): Promise<{ start: object, stop: object, since: string }> {
return await new Promise((resolve, reject) => {
return getRequestFn()({
return await new Promise((resolve, reject) => getRequestFn()({
uri: `http://${mjolnir.config.web.address}:${mjolnir.config.web.port}/api/1/ruleserver/updates/`,
method: "GET"
}, (error, _response, body) => {
}, (error: object, _response: any, body: string) => {
if (error) {
reject(error)
} else {
resolve(JSON.parse(body))
}
})});
}));
}

/**
* Wait for the rules to change as a result of the thunk. The returned promise will resolve when the rules being served have changed.
* @param thunk Should cause the rules the RuleServer is serving to change some way.
*/
async function waitForRuleChange(mjolnir: Mjolnir, thunk): Promise<void> {
async function waitForRuleChange(mjolnir: Mjolnir, thunk: any): Promise<void> {
const initialRules = await currentRules(mjolnir);
let rules = initialRules;
// We use JSON.stringify like this so that it is pretty printed in the log and human readable.
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"./test/integration/manualLaunchScript.ts",
"./test/integration/roomMembersTest.ts",
"./test/integration/banListTest.ts",
"./test/integration/reportPollingTest"
"./test/integration/reportPollingTest",
"./test/integration/policyConsumptionTest.ts",
]
}

0 comments on commit 6ee94d2

Please sign in to comment.