Open
Description
it("Will prompt for the policy list when it is missing", async function () {
const { protectedRoomsSet, policyRoomManager } = await createProtectedRooms();
const banResult = await CommandExecutorHelper.parseAndInvoke(
DraupnirBanCommand,
{
policyRoomManager,
roomResolver,
issuerManager: protectedRoomsSet.issuerManager,
defaultReasons: ["spam"],
clientUserID: `@draupnir:ourserver.example.com` as StringUserID,
},
{},
MatrixUserIDPresentationType.wrap(MatrixUserID.fromUserID("@spam:spam.example.com" as StringUserID)),
undefined, // no policy room provided, we expect a prompt.
);
if (isOk(banResult)) {
throw new TypeError(`We expect a prompt error to be returned`);
}
if (!(banResult.error instanceof PromptRequiredError)) {
throw new TypeError(`Expected to have a prompt required error`)
}
expect(banResult.error.parameterRequiringPrompt.name).toBe("list");
});
Would mean a test like this could also test that the prompt had been called properly.
Metadata
Metadata
Assignees
Labels
No labels