Files
radicle-explorer/src/Error.spec.ts
T
Rūdolfs Ošiņš 9b8a9a46dd Upgrade Cypress dependency
This gets rid of the testing-library-* and cypress-vite-devserver
dependencies and updates the specs according to the latest Cypress
documentation.

Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
2022-09-26 16:34:30 +02:00

45 lines
1.3 KiB
TypeScript

import Error from "./Error.svelte";
import { Failure } from "@app/error";
describe("Error", () => {
it("should show passed in props", () => {
cy.mount(Error, {
props: {
subtitle: "Subtitle of Modal",
error: {
type: Failure.InsufficientBalance,
txHash:
"0x8b678e51f970c5307bf45a8bcea373b597f9acbcea5c5ba784a1d383361a89d1",
message: "Not enough RAD",
},
},
});
cy.get("body").contains("Error").should("be.visible");
cy.get("body").contains("Subtitle of Modal").should("be.visible");
cy.get("body").contains("Not enough RAD").should("be.visible");
cy.get("button").contains("Back").should("be.visible");
});
it("should show custom error message", () => {
cy.mount(Error, {
props: {
subtitle: "Subtitle of Modal",
message: "Error message to check for",
},
});
cy.get("body").contains("Error message to check for").should("be.visible");
});
it("should change button label to Close when floating", () => {
cy.mount(Error, {
props: {
title: "Title of Modal",
subtitle: "Subtitle of Modal",
message: "Error message to check for",
floating: true,
},
});
cy.get("button").contains("Close").should("be.visible");
});
});