CEC-3672 Use SUMS version instead of Version (#279)

This commit is contained in:
John Wu
2023-02-10 16:31:19 -08:00
committed by GitHub
parent 9cf84fc426
commit 0da2289f37
7 changed files with 79 additions and 52 deletions

View File

@@ -242,13 +242,13 @@ export const CarUpdatesProvider = ({ children }) => {
return result;
};
const getSoftwareVersions = async (token) => {
const getSUMSVersions = async (token) => {
let result;
try {
setBusy(true);
result = await api.getSoftwareVersions(token);
result = await api.getSUMSVersions(token);
if (result.error)
throw new Error(`Get software versions error. ${result.message}`);
@@ -261,7 +261,7 @@ export const CarUpdatesProvider = ({ children }) => {
return result;
};
const updateManifestVersion = async (id, version, token) => {
const updateSUMSVersion = async (id, version, token) => {
let result;
try {
@@ -269,7 +269,7 @@ export const CarUpdatesProvider = ({ children }) => {
if (!validateSoftwareVersion(version)) throw new Error(`invalid version ${version}`);
result = await api.updateManifestVersion(id, version, token);
result = await api.updateSUMSVersion(id, version, token);
if (result.error)
throw new Error(`Update manifest version error. ${result.message}`);
} finally {
@@ -291,11 +291,11 @@ export const CarUpdatesProvider = ({ children }) => {
deployFleetUpdates,
getCarUpdates,
getLog,
getSoftwareVersions,
getSUMSVersions,
getVINUpdates,
startMonitor,
stopMonitor,
updateManifestVersion,
updateSUMSVersion,
}}
>
{children}

View File

@@ -60,6 +60,10 @@ let carUpdateLog = {
total: 3,
};
let sumsVersions = {
"data": ["2023.02.01.0.0.A", "2023.02.01.0.0.B"]
}
export const CarUpdatesProvider = ({ children }) => {
return <div data-testid="mocked-carupdatesprovider">{children}</div>;
};
@@ -77,4 +81,6 @@ export const useCarUpdatesContext = () => ({
startMonitor: jest.fn(),
stopMonitor: jest.fn(),
approveUpdate: jest.fn(),
});
getSUMSVersions: jest.fn(() => sumsVersions),
updateSUMSVersion: jest.fn(),
});