({
result: { container },
position,
label,
status,
}: {
result: RenderResult<Component>;
position: number;
label: string;
status: "In progress" | "Completed";
})
| 2 | import type { Component } from "svelte"; |
| 3 | |
| 4 | export const testProgress = ({ |
| 5 | result: { container }, |
| 6 | position, |
| 7 | label, |
| 8 | status, |
| 9 | }: { |
| 10 | result: RenderResult<Component>; |
| 11 | position: number; |
| 12 | label: string; |
| 13 | status: "In progress" | "Completed"; |
| 14 | }) => { |
| 15 | const element = container.querySelectorAll(".step")[position - 1]; |
| 16 | |
| 17 | if (status === "In progress") { |
| 18 | expect(element?.textContent ?? "").toContain(`${position}`); |
| 19 | } else if (status === "Completed") { |
| 20 | // Circle checkmark |
| 21 | expect(element.querySelector("svg")).not.toBeNull(); |
| 22 | } |
| 23 | |
| 24 | expect(element?.textContent ?? "").toContain(label); |
| 25 | expect(element?.textContent ?? "").toContain(status); |
| 26 | }; |
no test coverage detected