CEC-4854 Trunk-based deploy pipeline (#412)

* CEC-4855: fix manifest deselect (#410)

* fix manifest deselect

* adjusted blackduck pipeline to run the latest detect version

* added blackduck_rapid pipeline to run synopsys detect rapid scans

* adjusted deploy pipeline to trun-based model, adjusted test pipeline to use main branch

* test image builds

* clean up

* CEC-4563: add cancel and include results in promise (#411)

* splited build and deploy order according to each environment, test builds

* clean up

* clean up

* CEC-4635: prevent false 0 calculation (#413)

* prevent false 0 calculation

* refactor switch statement

---------

Co-authored-by: Tristan Timblin <ttimblin@fiskerinc.com>
This commit is contained in:
Milamary
2023-08-14 14:09:15 -05:00
committed by GitHub
parent 5b0d3a9437
commit e1f4da2232
9 changed files with 476 additions and 131 deletions

View File

@@ -127,8 +127,16 @@ export const CarUpdatesProvider = ({ children }) => {
};
const getDownloadProgress = (status) => {
if (status.package_total > 0)
const disabled = status.status === "install_succeeded";
if (disabled) {
return -1;
}
const calculated = status.package_total > 0;
if (calculated) {
return Math.floor((100 * status.package_current) / status.package_total);
}
return 0;
};

View File

@@ -274,12 +274,10 @@ const MainForm = () => {
const handleSelect = (event, manifest) => {
setUpdateManifestIds((selected) => {
if (event.target.checked && selected.find((id) => id === manifest.id)) {
return selected;
} else if (event.target.checked) {
if (event.target.checked) {
return [...selected, manifest.id];
}
return selected.filter(({ id }) => id !== manifest.id);
return selected.filter(id => id !== manifest.id);
});
};

View File

@@ -3,6 +3,7 @@ jest.mock("../../Contexts/UserContext");
import React from "react";
import { render, screen, fireEvent } from "@testing-library/react";
import userEvent from '@testing-library/user-event';
import { BrowserRouter } from "react-router-dom";
import { UserProvider, setToken } from "../../Contexts/UserContext";
@@ -32,4 +33,14 @@ describe("Manifest List Component", () => {
fireEvent.click(screen.getByText("Archived"));
expect(archiveActionEl.innerHTML).toBe("Activate");
});
it("properly selects and deselects a manifest", () => {
const { queryAllByRole } = render(Page);
const checkbox = queryAllByRole("checkbox")[0];
expect(checkbox).not.toBeChecked();
userEvent.click(checkbox);
expect(checkbox).toBeChecked();
userEvent.click(checkbox);
expect(checkbox).not.toBeChecked();
})
});