Skip to content

Commit

Permalink
Add a test for join screen
Browse files Browse the repository at this point in the history
  • Loading branch information
SmileyJames committed Jul 17, 2021
1 parent a029425 commit a7c6493
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions app/src/components/join-screen/JoinScreen.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { render } from '@testing-library/react';
import JoinScreen from "./index";
import QRCode from "qrcode.react"

let qrValue;
jest.mock('qrcode.react', () => ({ value }) => {
qrValue = value;
return null;
})

describe("Join screen", () => {
test("Renders code as text, QR and link", () => {
const { queryByText, getByRole } = render(
<JoinScreen roomCode="XVXV"/>
);

const textCode = queryByText("XVXV");
expect(textCode).toBeInTheDocument();

expect(qrValue).toBe("http://localhost/guest/XVXV")

const link = getByRole("link");
expect(link.href).toBe("http://localhost/guest/XVXV")
})
})

0 comments on commit a7c6493

Please sign in to comment.