Skip to content

Commit

Permalink
add test without trailing slash
Browse files Browse the repository at this point in the history
  • Loading branch information
gabalafou committed Nov 22, 2024
1 parent 620eab8 commit e067009
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion test/artifacts/ArtifactsList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import { render, screen } from "@testing-library/react";
import { ArtifactList } from "../../src/features/artifacts/components";
import { mockTheme } from "../testutils";
import { prefGlobal } from "../../src/preferences";
import { prefGlobal, prefDefault } from "../../src/preferences";

const ARTIFACTS = [
{
Expand All @@ -24,4 +24,17 @@ describe("<ArtifactList />", () => {
"http://localhost:8080/conda-store/api/v1/build/1/lockfile/"
);
});

it("should render correct URL if API base url lacks trailing slash", () => {
prefGlobal.set({
...prefDefault,
apiUrl: "http://localhost:8080/conda-store"
});

render(mockTheme(<ArtifactList artifacts={ARTIFACTS} />));
expect(screen.getByText("Show lockfile")).toHaveAttribute(
"href",
"http://localhost:8080/conda-store/api/v1/build/1/lockfile/"
);
});
});

0 comments on commit e067009

Please sign in to comment.