CEC-749 Generate cert UI (#141)
* Add Create Certificate page * Tests * Update permission check * Use Azure
This commit is contained in:
@@ -37,22 +37,35 @@ const check = async (path, selector, compare) => {
|
||||
|
||||
const sleepAndCheck = async (path, selector, compare) => {
|
||||
const container = await renderRoute(path);
|
||||
await waitFor(() => { });
|
||||
await waitFor(() => {});
|
||||
expect(container.querySelector(selector).innerHTML).toEqual(compare);
|
||||
expect(container).toMatchSnapshot();
|
||||
};
|
||||
|
||||
describe("App", () => {
|
||||
const rxMakeStyles = /makeStyles-(\w+)-(\d+)/gi;
|
||||
|
||||
beforeAll(() => {
|
||||
// Stablize Table Pagination control ids
|
||||
expect.addSnapshotSerializer({
|
||||
test: function (val) {
|
||||
return val && typeof val === "string" && val.indexOf("mui-") >= 0;
|
||||
return val && typeof val === "string" && val.indexOf("mui-") > -1;
|
||||
},
|
||||
print: function (val) {
|
||||
let str = val;
|
||||
str = str.replace(/mui-\d*/g, "mui-00000");
|
||||
|
||||
return `"${str}"`;
|
||||
},
|
||||
});
|
||||
expect.addSnapshotSerializer({
|
||||
test: (val) => {
|
||||
return val && typeof val === "string" && val.search(rxMakeStyles) > -1;
|
||||
},
|
||||
print: function (val) {
|
||||
let str = val;
|
||||
str = str.replace(rxMakeStyles, "makeStyles-$1-0000");
|
||||
|
||||
return `"${str}"`;
|
||||
},
|
||||
});
|
||||
@@ -107,6 +120,10 @@ describe("App", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("Route /tools/certificates/add unauthenticated", async () => {
|
||||
await check("/tools/certificates/add", "span.MuiButton-label", "Sign In");
|
||||
});
|
||||
|
||||
it("Route /page-not-found unauthenticated", async () => {
|
||||
await check("/page-not-found", "h1", "Page Not Found");
|
||||
});
|
||||
@@ -159,4 +176,9 @@ describe("App", () => {
|
||||
setToken(TEST_AUTH_OBJECT);
|
||||
await check("/vehicle-status/FISKER123", "h6", "Vehicle FISKER123 Details");
|
||||
});
|
||||
|
||||
it("Route /tools/certificates/add authenticated", async () => {
|
||||
setToken(TEST_AUTH_OBJECT);
|
||||
await check("/tools/certificates/add", "h6", "Create Certificate");
|
||||
});
|
||||
});
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user