CEC-180 Cache Control (#30)

* Set cache expire to 1 day
Add snapshot tests for new screens

* Fix table pagniation random ids for snapshot tests

* Auto reload on chunk load error

* OTA Admin Portal => Admin Portal
This commit is contained in:
John Wu
2021-04-13 17:52:10 -07:00
committed by GitHub
parent 1f9db5454f
commit 7a1125cb1f
13 changed files with 3180 additions and 173 deletions

View File

@@ -7,8 +7,8 @@ import {
fireEvent,
waitFor,
} from "@testing-library/react";
import { UpdatesProvider, useUpdatesContext } from "../Contexts/UpdatesContext";
import { StatusProvider, useStatusContext } from "../Contexts/StatusContext";
import { UpdatesProvider, useUpdatesContext } from "./UpdatesContext";
import { StatusProvider, useStatusContext } from "./StatusContext";
import { TEST_AUTH_OBJECT } from "../../utils/testing";
describe("UpdatesContext", () => {

View File

@@ -0,0 +1,26 @@
import React from "react";
const UpdatesContext = React.createContext();
let busy = false;
let packages = [];
let totalPackages = 0;
let carUpdates = [];
let totalCarUpdates = 0;
export const UpdatesProvider = ({ children }) => {
return <div data-testid="mocked-updatesprovider">{children}</div>;
};
export const useUpdatesContext = () => ({
busy,
packages,
totalPackages,
carUpdates,
totalCarUpdates,
getPackages: jest.fn(() => packages),
updatePackage: jest.fn((data) => data),
createCarUpdates: jest.fn((data) => data),
getCarUpdates: jest.fn(() => carUpdates),
getVINUpdates: jest.fn(() => carUpdates),
});

View File

@@ -2,6 +2,7 @@ import React from "react";
let busy = false;
let vehicles = [];
let totalVehicles = 0;
let error = null;
export const VehicleProvider = ({ children }) => {
@@ -11,6 +12,7 @@ export const VehicleProvider = ({ children }) => {
export const useVehicleContext = () => ({
busy,
vehicles,
totalVehicles,
getVehicles: jest.fn(() => vehicles),
addVehicle: jest.fn(),
});