import React from "react"; const CarUpdatesContext = React.createContext(); let busy = false; let carUpdates = [ { id: 1, vin: "1G1FP87S3GN100062", manifest_id: 283, status: "downloaded", msg: "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", release_notes: "https://releasenotes.com", ecu_list: "AGS 1.0.0,AMP 1.0.0", created: "2021-08-20T18:37:41.960397Z", updated: "2021-08-20T18:37:50.007853Z", }, }, { id: 2, vin: "1G1FP87S3GN100062", manifest_id: 285, status: "downloaded", msg: "downloaded", created: "2021-07-01T22:40:07.778509Z", updated: "2021-07-12T18:22:13.736755Z", updatemanifest: { id: 285, name: "TEST UPDATE", version: "1000", description: "UPDATE DESCRIPTION", release_notes: "https://releasenotes.com", ecu_list: "AGS 1.0.0,AMP 1.0.0", created: "2021-08-20T18:37:41.960397Z", updated: "2021-08-20T18:37:50.007853Z", }, }, { id: 3, vin: "1G1FP87S3GN100062", manifest_id: 286, status: "downloaded", msg: "downloaded", created: "2021-07-01T22:40:07.778509Z", updated: "2021-07-12T18:22:13.736755Z", updatemanifest: { id: 286, name: "TEST UPDATE", version: "1000", description: "UPDATE DESCRIPTION", release_notes: "https://releasenotes.com", 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 = 2; let carUpdateLog = { data: [ { id: 90, carupdate_id: 283, username: "test username 1", 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, username: "test username 2", status: "package_install_start", error_code: 0, info: "TEST", created: "2021-08-23T17:06:38.030052Z", updated: "2021-08-23T17:06:38.030052Z", }, { id: 88, carupdate_id: 284, username: "test username 3", status: "install_approval_await", error_code: 0, info: "TEST", created: "2021-08-23T17:06:38.030052Z", updated: "2021-08-23T17:06:38.030052Z", }, { id: 87, carupdate_id: 285, username: "test username 2", status: "install_scheduled", error_code: 0, info: "TEST", created: "2021-08-23T17:06:38.030052Z", updated: "2021-08-23T17:06:38.030052Z", }, { id: 86, carupdate_id: 286, username: "test username 2", status: "requirements_failed", error_code: 0, info: "TEST", created: "2021-08-23T17:06:38.030052Z", updated: "2021-08-23T17:06:38.030052Z", }, ], total: 3, }; let sumsVersions = { "data": ["2023.02.01.0.0.A", "2023.02.01.0.0.B"] } export const CarUpdatesProvider = ({ children }) => { return
{children}
; }; export const useCarUpdatesContext = () => ({ busy, carUpdates, totalCarUpdates, deployCarUpdates: jest.fn((data) => data), getCarUpdates: jest.fn(() => ({ data: carUpdates, })), getLog: jest.fn(() => carUpdateLog), getVINUpdates: jest.fn(() => carUpdates), startMonitor: jest.fn(), stopMonitor: jest.fn(), approveUpdate: jest.fn(), getSUMSVersions: jest.fn(() => sumsVersions), updateSUMSVersion: jest.fn(), });