import { Given, Then } from "@badeball/cypress-cucumber-preprocessor"; import { ErrorCode } from "@batch-cooking/shared"; Given("the account deletion request will fail because the credentials are invalid", () => { cy.intercept("DELETE", "**/auth/me", { statusCode: 401, body: { code: ErrorCode.INVALID_CREDENTIALS, message: "Invalid password" }, }).as("deleteAccount"); }); Given("the account deletion request will succeed", () => { cy.intercept("DELETE", "**/auth/me", { statusCode: 204 }).as("deleteAccount"); }); Given("the account deletion request is being watched", () => { cy.intercept("DELETE", "**/auth/me").as("deleteAccount"); }); Then("the account deletion request should have been made", () => { cy.wait("@deleteAccount"); }); Then( "the account deletion request should have been made with password {string}", (password: string) => { cy.wait("@deleteAccount").its("request.body").should("deep.equal", { password }); }, ); Then("the account deletion request should not have been made", () => { cy.get("@deleteAccount.all").should("have.length", 0); });