Files
jambonz-webapp/src/components/require-auth.cy.tsx
T
7890b7031f feat: update @jambonz/ui-kit:0.0.21 (#200)
* feat: update @jambonz/ui-kit:0.0.21

* fix security vulnerabilities

---------

Co-authored-by: Quan HL <quanluuhoang8@gmail.com>
Co-authored-by: Dave Horton <daveh@beachdognet.com>
2023-02-13 08:47:56 -05:00

36 lines
778 B
TypeScript

import React from "react";
import { H1 } from "@jambonz/ui-kit";
import { RequireAuth } from "./require-auth";
/** Wrapper to pass different auth contexts */
const RequireAuthTestWrapper = () => {
return (
<RequireAuth>
<div className="auth-div">
<H1>Protected Route</H1>
</div>
</RequireAuth>
);
};
describe("<RequireAuth>", () => {
it("mounts", () => {
cy.mountTestProvider(<RequireAuthTestWrapper />);
});
it("is not authorized", () => {
cy.mountTestProvider(<RequireAuthTestWrapper />);
cy.get(".auth-div").should("not.exist");
});
it("is authorized", () => {
cy.mountTestProvider(<RequireAuthTestWrapper />, {
authProps: { authorized: true },
});
cy.get(".auth-div").should("exist");
});
});