import { Given, Then } from "@badeball/cypress-cucumber-preprocessor";

Given("my saved theme preference is {string}", (theme: string) => {
  cy.intercept("GET", "**/preferences", { statusCode: 200, body: { theme } });
});

Given("updating the theme preference will succeed", () => {
  cy.intercept("PATCH", "**/preferences", { statusCode: 200, body: { theme: "LIGHT" } }).as(
    "updatePreferences",
  );
});

Then("the theme update request should have been made with theme {string}", (theme: string) => {
  cy.wait("@updatePreferences").its("request.body").should("deep.equal", { theme });
});
