diff --git a/src/containers/login/layout.cy.tsx b/src/containers/login/layout.cy.tsx
new file mode 100644
index 0000000..41a16b3
--- /dev/null
+++ b/src/containers/login/layout.cy.tsx
@@ -0,0 +1,24 @@
+import React from "react";
+
+import { Layout } from "./layout";
+import { LayoutProvider } from "src/test";
+
+const LayoutTestWrapper = () => {
+ return (
+ } />
+ );
+};
+
+describe("", () => {
+ it("mounts", () => {
+ cy.mount();
+ });
+
+ it("has required elements", () => {
+ cy.mount();
+
+ cy.get("header").should("exist");
+ cy.get("footer").should("exist");
+ cy.get(".outlet-div").should("exist");
+ });
+});
diff --git a/src/containers/login/layout.tsx b/src/containers/login/layout.tsx
index 0e07605..f5c6ac4 100644
--- a/src/containers/login/layout.tsx
+++ b/src/containers/login/layout.tsx
@@ -4,6 +4,8 @@ import { MXS } from "jambonz-ui";
import { Icons } from "src/components";
+import "./styles.scss";
+
export const Layout = () => (
diff --git a/src/containers/login/login.tsx b/src/containers/login/login.tsx
index c8113db..7aaa341 100644
--- a/src/containers/login/login.tsx
+++ b/src/containers/login/login.tsx
@@ -11,8 +11,6 @@ import {
ROUTE_CREATE_PASSWORD,
} from "src/router/routes";
-import "./styles.scss";
-
export const Login = () => {
const { signin, authorized } = useAuth();
const location = useLocation();
diff --git a/src/test/index.tsx b/src/test/index.tsx
index 7560292..b17f66d 100644
--- a/src/test/index.tsx
+++ b/src/test/index.tsx
@@ -9,9 +9,14 @@ import type { AuthStateContext } from "src/router/auth";
import userLogin from "../../cypress/fixtures/userLogin.json";
-interface TestProviderProps extends Partial {
- children: React.ReactNode;
-}
+type TestProviderProps = Partial & {
+ children?: React.ReactNode;
+};
+
+type LayoutProviderProps = TestProviderProps & {
+ outlet: JSX.Element;
+ Layout: React.ElementType;
+};
export const signinError = () => Promise.reject(MSG_SOMETHING_WRONG);
export const signinSuccess = () => Promise.resolve(userLogin);
@@ -23,6 +28,9 @@ export const authProps: AuthStateContext = {
authorized: false,
};
+/**
+ * Use this when you simply need to wrap with state and auth
+ */
export const TestProvider = ({ children, ...restProps }: TestProviderProps) => {
return (
@@ -41,3 +49,31 @@ export const TestProvider = ({ children, ...restProps }: TestProviderProps) => {
);
};
+
+/**
+ * Use this when you also need to test the react-router-dom layouts
+ */
+export const LayoutProvider = ({
+ Layout,
+ outlet,
+ ...restProps
+}: LayoutProviderProps) => {
+ return (
+
+
+
+
+ }>
+
+
+
+
+
+
+ );
+};