Development (#94)
* CEC-371 Car ECU display (#79) * Merge Development (#53) * Use responsive iframe control for charts (#49) * Use responsive iframe control to charts * Move external Grafana link to Dashboard page * Remove unused embedded style class * Add button label * added delete button to deploy packages * Fix unit test warning Remove unused route from test * Fix styling of button * minor fixes per pr review Co-authored-by: jcw-fisker <jwatson@fiskerinc.com> Co-authored-by: John Cotten Watson <83605808+jcw-fisker@users.noreply.github.com> * Development Merge (#57) * CEC-287 Car connection status (#59) (#60) * Car connection status * Formatting * Merge Development (#64) * Add connection status to vehicles page * ConnectedIcon control * Handle Style * Development (#67) * preliminary map for vehicles * weird zoom bug * passing react tests * fixing warnings and updating snapshots * update node environment to 14 * addressing comments by changing variable types and adding styles to home page title * adding CODEOWNERS file * fixing token error * CEC-371 Update car ECUs display (#78) * Clean up className styles Update car status page to show update and ECUs * Add update ecu version button Show all ECUs on car status page Only show car ecus for search Co-authored-by: jcw-fisker <jwatson@fiskerinc.com> Co-authored-by: John Cotten Watson <83605808+jcw-fisker@users.noreply.github.com> Co-authored-by: Drew Taylor <69828061+drew-fisker@users.noreply.github.com> * CEC-394 Car update log (#81) * CEC-394 Car update status control * Remove Datadog RUM Remove package update components Move control components into Controls folder Add Car update status page * Display update status log Clean up unused update package code * Remove console.logs * no vars * adding timestamp to vehicle popup * modifying vehicle data query * removing extraneous code * removing console log * Clean up SonarCloud warnings (#83) * Clean up SonarCloud warnings * Bogus security warning * Fix another warning * Fix unauthorized locations request * Fix update progress control * CEC-563 New manifest format (#88) * Add ManifestCreateContext Update create manifest page * Finish UI changes and API integration * Fixes * Fix test * Remove manifest ECU file version and type * Fixes * Add manifest ecu file type control * Fix Sonar warnings * Fix test * Update codeowners * Formatting * CEC-553 Change file type to string (#90) * CEC-553 File type uses string enum * Fix test timeout * Fix * Merge development * Increase timeout * Clean up (#95) * Clean up Mock missing methods * Smell Co-authored-by: jcw-fisker <jwatson@fiskerinc.com> Co-authored-by: John Cotten Watson <83605808+jcw-fisker@users.noreply.github.com> Co-authored-by: Drew Taylor <69828061+drew-fisker@users.noreply.github.com> Co-authored-by: Drew Taylor <dtaylor@fiskerinc.com>
This commit is contained in:
53
src/components/Contexts/__mocks__/ManifestCreateContext.jsx
Normal file
53
src/components/Contexts/__mocks__/ManifestCreateContext.jsx
Normal file
@@ -0,0 +1,53 @@
|
||||
import React from "react";
|
||||
|
||||
const ManifestsContext = React.createContext();
|
||||
|
||||
let busy = false;
|
||||
let ecus = [
|
||||
{
|
||||
data_id: 0,
|
||||
name: "AGS",
|
||||
part_number: "",
|
||||
version: "",
|
||||
serial_number: "",
|
||||
hw_version: "",
|
||||
vendor: "",
|
||||
configuration: "",
|
||||
fingerprint: "",
|
||||
manifest_id: 0,
|
||||
files: [
|
||||
{
|
||||
filename: "test.bin",
|
||||
order: 0,
|
||||
offset: "0",
|
||||
checksum: "",
|
||||
type: 1,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
let uploadedFiles = [];
|
||||
let uploadFileIndex = 0;
|
||||
let uploadProgress = 0;
|
||||
let uploadStatus = null;
|
||||
|
||||
export const ManifestCreateProvider = ({ children }) => {
|
||||
return <div data-testid="mocked-manifestcreateprovider">{children}</div>;
|
||||
};
|
||||
|
||||
export const useManifestCreateContext = () => ({
|
||||
busy,
|
||||
ecus,
|
||||
uploadedFiles,
|
||||
uploadFileIndex,
|
||||
uploadProgress,
|
||||
uploadStatus,
|
||||
addECU: jest.fn(),
|
||||
addECUFile: jest.fn(),
|
||||
cancelUpload: jest.fn(),
|
||||
createManifest: jest.fn(),
|
||||
createManifestECU: jest.fn(),
|
||||
deleteECU: jest.fn(),
|
||||
deleteECUFile: jest.fn(),
|
||||
updateECUs: jest.fn(),
|
||||
});
|
||||
@@ -17,17 +17,18 @@ export const UserProvider = ({ children }) => {
|
||||
};
|
||||
|
||||
export const useUserContext = () => ({
|
||||
token,
|
||||
fetching,
|
||||
error,
|
||||
fetching,
|
||||
groups,
|
||||
signIn: jest.fn(() => signInResp),
|
||||
signOut: jest.fn(),
|
||||
token,
|
||||
getAuthorizeURL: jest.fn(() => authorizeURL),
|
||||
getLogoutURL: jest.fn(() => logoutURL),
|
||||
setError: jest.fn((value) => {
|
||||
error = value;
|
||||
}),
|
||||
signIn: jest.fn(() => signInResp),
|
||||
signOut: jest.fn(),
|
||||
refresh: jest.fn(),
|
||||
});
|
||||
|
||||
export const setToken = (val) => {
|
||||
|
||||
@@ -13,9 +13,9 @@ export const VehicleProvider = ({ children }) => {
|
||||
|
||||
export const useVehicleContext = () => ({
|
||||
busy,
|
||||
vehicles,
|
||||
totalVehicles,
|
||||
models,
|
||||
totalVehicles,
|
||||
vehicles,
|
||||
years,
|
||||
addVehicle: jest.fn(),
|
||||
getConnections: jest.fn((vins, token) => {
|
||||
@@ -58,18 +58,19 @@ export const useVehicleContext = () => ({
|
||||
total: 2,
|
||||
};
|
||||
}),
|
||||
getModels: jest.fn(() => {
|
||||
models = ["Ocean", "PEAR"];
|
||||
}),
|
||||
getLocations: jest
|
||||
.fn()
|
||||
.mockResolvedValue([
|
||||
{ altitude: 5, longitude: 10, latitude: 15, vin: "TESTVIN123" },
|
||||
]),
|
||||
getVehicles: jest.fn(() => vehicles),
|
||||
getModels: jest.fn(() => {
|
||||
models = ["Ocean", "PEAR"];
|
||||
}),
|
||||
getState: jest.fn(),
|
||||
getYears: jest.fn(() => {
|
||||
years = [2023, 2024];
|
||||
}),
|
||||
getVehicles: jest.fn(() => vehicles),
|
||||
sendCommand: jest.fn((vins, command, parameters, token) => ({
|
||||
vins,
|
||||
command,
|
||||
|
||||
Reference in New Issue
Block a user