Merge CEC-394 Car update log (#82)
This commit is contained in:
@@ -11,9 +11,38 @@ let carUpdates = [
|
||||
status: "downloaded",
|
||||
created: "2021-07-01T22:40:07.778509Z",
|
||||
updated: "2021-07-12T18:22:13.736755Z",
|
||||
updatemanifest: {
|
||||
id: 283,
|
||||
name: "TEST UPDATE",
|
||||
version: "1000",
|
||||
description: "UPDATE DESCRIPTION",
|
||||
ecu_list: "AGS 1.0.0,AMP 1.0.0",
|
||||
created: "2021-08-20T18:37:41.960397Z",
|
||||
updated: "2021-08-20T18:37:50.007853Z",
|
||||
},
|
||||
},
|
||||
];
|
||||
let totalCarUpdates = 1;
|
||||
let carUpdateLog = {
|
||||
data: [
|
||||
{
|
||||
id: 90,
|
||||
status: "package_install_complete",
|
||||
error_code: 0,
|
||||
created: "2021-08-23T17:06:38.410115Z",
|
||||
updated: "2021-08-23T17:06:38.410115Z",
|
||||
},
|
||||
{
|
||||
id: 89,
|
||||
carupdate_id: 283,
|
||||
status: "package_install_start",
|
||||
error_code: 0,
|
||||
created: "2021-08-23T17:06:38.030052Z",
|
||||
updated: "2021-08-23T17:06:38.030052Z",
|
||||
},
|
||||
],
|
||||
total: 2,
|
||||
};
|
||||
|
||||
export const CarUpdatesProvider = ({ children }) => {
|
||||
return <div data-testid="mocked-carupdatesprovider">{children}</div>;
|
||||
@@ -24,7 +53,10 @@ export const useCarUpdatesContext = () => ({
|
||||
carUpdates,
|
||||
totalCarUpdates,
|
||||
deployCarUpdates: jest.fn((data) => data),
|
||||
getCarUpdates: jest.fn(() => carUpdates),
|
||||
getCarUpdates: jest.fn(() => ({
|
||||
data: carUpdates,
|
||||
})),
|
||||
getLog: jest.fn(() => carUpdateLog),
|
||||
getVINUpdates: jest.fn(() => carUpdates),
|
||||
startMonitor: jest.fn(),
|
||||
stopMonitor: jest.fn(),
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
import React from "react";
|
||||
|
||||
const UpdatesContext = React.createContext();
|
||||
|
||||
let busy = false;
|
||||
let packages = [];
|
||||
const examplePackage = {
|
||||
id: 0,
|
||||
package_name: "Package",
|
||||
version: "1.0",
|
||||
desc: "Description",
|
||||
release_notes: "https://www.google.com/",
|
||||
timestamp: 1625615299,
|
||||
created: "2021-07-01T22:40:07.778509Z",
|
||||
updated: "2021-07-12T18:22:13.736755Z",
|
||||
};
|
||||
packages.push(examplePackage);
|
||||
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),
|
||||
startMonitor: jest.fn(),
|
||||
stopMonitor: jest.fn(),
|
||||
});
|
||||
Reference in New Issue
Block a user