Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import userEvent from "@testing-library/user-event";
import { dummyDeployment } from "~/__fixtures__/dummy-deployment";
import { dummyTrigger } from "~/__fixtures__/dummy-trigger";
import { render, screen, MemoryRouter, waitFor, act } from "~~/test-utils";
import { DeploymentDetail } from ".";
import { DeploymentStatus } from "~~/model/deployment_pb";
import { Deployment, DeploymentStatus } from "~~/model/deployment_pb";
import * as deploymentsApi from "~/api/deployments";
import { server } from "~/mocks/server";

Expand Down Expand Up @@ -38,6 +39,32 @@ describe("DeploymentDetail", () => {
expect(screen.getByText(dummyDeployment.summary)).toBeInTheDocument();
});

it("renders gracefully when commit hash is undefined", async () => {
const deploymentWithoutHash: Deployment.AsObject = {
...dummyDeployment,
trigger: {
...dummyTrigger,
commit: {
...dummyTrigger.commit!,
hash: (undefined as unknown) as string,
},
},
};

render(
<MemoryRouter>
<DeploymentDetail
deploymentId={dummyDeployment.id}
deployment={deploymentWithoutHash}
/>
</MemoryRouter>
);

await waitFor(() => {
expect(screen.getByText("SUCCESS")).toBeInTheDocument();
});
});

describe("status: RUNNING", () => {
beforeEach(() => {
render(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,9 @@ export const DeploymentDetail: FC<DeploymentDetailProps> = memo(
target="_blank"
rel="noreferrer"
>
{`${deployment.trigger.commit.hash.slice(
0,
7
)}`}
{`${(
deployment.trigger.commit.hash ?? ""
).slice(0, 7)}`}
<OpenInNewIcon
sx={{
fontSize: 16,
Expand Down
Loading