Skip to content

Commit

Permalink
Use exclamation in tests for enforce better error msgs
Browse files Browse the repository at this point in the history
  • Loading branch information
carbonrobot committed Jan 17, 2024
1 parent 6808d0f commit e7bb003
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/victory-line/src/victory-line.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe("components/victory-line", () => {
it("renders an svg with the correct viewBox", () => {
const { container } = render(<VictoryLine />);
const viewBoxValue = `0 0 ${450} ${300}`;
expect(container.querySelector("svg")?.getAttribute("viewBox")).toEqual(
expect(container.querySelector("svg")!.getAttribute("viewBox")).toEqual(
viewBoxValue,
);
});
Expand Down Expand Up @@ -87,7 +87,7 @@ describe("components/victory-line", () => {

const { container } = render(<VictoryLine {...props} />);

expect(container.querySelector("path")?.getAttribute("d")).toEqual(
expect(container.querySelector("path")!.getAttribute("d")).toEqual(
calculateD3Path(props, "line", 0),
);
});
Expand All @@ -108,7 +108,7 @@ describe("components/victory-line", () => {

const { container } = render(<VictoryLine {...props} />);

expect(container.querySelector("path")?.getAttribute("d")).toEqual(
expect(container.querySelector("path")!.getAttribute("d")).toEqual(
calculateD3Path(props, "line", 0),
);
});
Expand All @@ -129,7 +129,7 @@ describe("components/victory-line", () => {

const { container } = render(<VictoryLine {...props} />);

expect(container.querySelector("path")?.getAttribute("d")).toEqual(
expect(container.querySelector("path")!.getAttribute("d")).toEqual(
calculateD3Path(props, "line", 0),
);
});
Expand Down Expand Up @@ -173,7 +173,7 @@ describe("components/victory-line", () => {
);

const line = container.querySelector("path");
const renderedData = JSON.parse(line?.getAttribute("data-json") || "");
const renderedData = JSON.parse(line!.getAttribute("data-json") || "");

expect(renderedData[0].t).toEqual(1);
expect(renderedData[1].t).toEqual(0);
Expand All @@ -195,7 +195,7 @@ describe("components/victory-line", () => {

const line = container.querySelector("path");
const renderedData = JSON.parse(
line?.getAttribute("data-json") || "",
line!.getAttribute("data-json")!,
).map(({ t }) => t);

expect(renderedData).toEqual([0, 1]);
Expand Down Expand Up @@ -272,7 +272,7 @@ describe("components/victory-line", () => {
it("adds an aria role to a line segment", () => {
const { container } = render(<VictoryLine />);

expect(container.querySelector("path")?.getAttribute("role")).toEqual(
expect(container.querySelector("path")!.getAttribute("role")).toEqual(
"presentation",
);
});
Expand Down Expand Up @@ -318,7 +318,7 @@ describe("components/victory-line", () => {
`data point 3's x value is 2`,
);

expect(parseInt(path?.getAttribute("tabindex") || "")).toEqual(3);
expect(parseInt(path!.getAttribute("tabindex")!)).toEqual(3);
});
});
});

0 comments on commit e7bb003

Please sign in to comment.