CEC-247, CEC-261 Manifest and ECU display (#65)
* CEC-261 Add ECU list control * CEC-261 Update vehicle service mock * CEC-247 Manifest screens * Fix test * Remove dynamic dates from mocks * Remove timezone from mock dates * Fix test for date string timezone difference
This commit is contained in:
31
src/components/Contexts/__mocks__/CarUpdatesContext.jsx
Normal file
31
src/components/Contexts/__mocks__/CarUpdatesContext.jsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import React from "react";
|
||||
|
||||
const CarUpdatesContext = React.createContext();
|
||||
|
||||
let busy = false;
|
||||
let carUpdates = [
|
||||
{
|
||||
id: 1,
|
||||
vin: "1G1FP87S3GN100062",
|
||||
updatepackage_id: 18,
|
||||
status: "downloaded",
|
||||
created: "2021-07-01T22:40:07.778509Z",
|
||||
updated: "2021-07-12T18:22:13.736755Z",
|
||||
},
|
||||
];
|
||||
let totalCarUpdates = 1;
|
||||
|
||||
export const CarUpdatesProvider = ({ children }) => {
|
||||
return <div data-testid="mocked-carupdatesprovider">{children}</div>;
|
||||
};
|
||||
|
||||
export const useCarUpdatesContext = () => ({
|
||||
busy,
|
||||
carUpdates,
|
||||
totalCarUpdates,
|
||||
deployCarUpdates: jest.fn((data) => data),
|
||||
getCarUpdates: jest.fn(() => carUpdates),
|
||||
getVINUpdates: jest.fn(() => carUpdates),
|
||||
startMonitor: jest.fn(),
|
||||
stopMonitor: jest.fn(),
|
||||
});
|
||||
27
src/components/Contexts/__mocks__/ManifestsContext.jsx
Normal file
27
src/components/Contexts/__mocks__/ManifestsContext.jsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import React from "react";
|
||||
|
||||
const ManifestsContext = React.createContext();
|
||||
|
||||
let busy = false;
|
||||
let manifests = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Test Manifest",
|
||||
version: "1.0",
|
||||
created: "2021-07-01T22:40:07.778509Z",
|
||||
updated: "2021-07-12T18:22:13.736755Z",
|
||||
},
|
||||
];
|
||||
let totalManifests = 1;
|
||||
|
||||
export const ManifestsProvider = ({ children }) => {
|
||||
return <div data-testid="mocked-manifestsprovider">{children}</div>;
|
||||
};
|
||||
|
||||
export const useManifestsContext = () => ({
|
||||
busy,
|
||||
manifests,
|
||||
totalManifests,
|
||||
getManifests: jest.fn(() => manifests),
|
||||
deleteManifest: jest.fn(),
|
||||
});
|
||||
@@ -10,9 +10,11 @@ const examplePackage = {
|
||||
version: "1.0",
|
||||
desc: "Description",
|
||||
release_notes: "https://www.google.com/",
|
||||
created: Date.now().toString(),
|
||||
timestamp: 1625615299,
|
||||
created: "2021-07-01T22:40:07.778509Z",
|
||||
updated: "2021-07-12T18:22:13.736755Z",
|
||||
};
|
||||
packages.push(examplePackage)
|
||||
packages.push(examplePackage);
|
||||
let totalPackages = 0;
|
||||
let carUpdates = [];
|
||||
let totalCarUpdates = 0;
|
||||
|
||||
Reference in New Issue
Block a user