Skip to content

Commit

Permalink
fix: test syntax error
Browse files Browse the repository at this point in the history
  • Loading branch information
lublagg committed Nov 18, 2024
1 parent c09d161 commit 6a80582
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/chat-transcript.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ describe("test chat transcript component", () => {
const shouldBeLive = chatTranscript.messages[index].speaker === "DAVAI";

expect(message).toHaveAttribute("aria-label", labelContent);
const matcher = shouldBeLive ? expect(message).toHaveAttribute : expect(message).not.toHaveAttribute;
matcher.call(expect(message), "aria-live", shouldBeLive ? "assertive" : undefined);
if (shouldBeLive) {
expect(message).toHaveAttribute("aria-live", "assertive");

Check failure on line 37 in src/components/chat-transcript.test.tsx

View workflow job for this annotation

GitHub Actions / Build and Run Jest Tests

Avoid calling `expect` conditionally`
} else {
expect(message).not.toHaveAttribute("aria-live");

Check failure on line 39 in src/components/chat-transcript.test.tsx

View workflow job for this annotation

GitHub Actions / Build and Run Jest Tests

Avoid calling `expect` conditionally`
}

const speaker = within(message).getByTestId("chat-message-speaker");
expect(speaker).toBeInTheDocument();
Expand Down

0 comments on commit 6a80582

Please sign in to comment.