4828
Sr
stream-together / files
stream-together / __tests__ / stream-settings.test.tsx
1.2 KB
1import { render, screen } from "@testing-library/react"; 2 3import StreamSettings from "@/components/stream-settings"; 4 5describe("Settings component", () => { 6 it("renders the inputs", async () => { 7 const availableCameras = [{ id: "selectedCam", label: "testCam" }]; 8 const selectedCameraId = "selectedCam"; 9 const setSelectedCameraId = jest.fn; 10 11 const availableMicrophones = [{ id: "selectedMic", label: "testMic" }]; 12 const selectedMicrophoneId = "selectedMic"; 13 const setSelectedMicrophoneId = jest.fn; 14 15 const backgroundBlurred = false; 16 const handleBlurBackground = jest.fn; 17 18 render( 19 <StreamSettings 20 {...{ 21 availableCameras, 22 selectedCameraId, 23 setSelectedCameraId, 24 availableMicrophones, 25 selectedMicrophoneId, 26 setSelectedMicrophoneId, 27 backgroundBlurred, 28 handleBlurBackground, 29 }} 30 />, 31 ); 32 33 const cameraSelection = await screen.findByText("testCam"); 34 expect(cameraSelection).toBeInTheDocument(); 35 36 const micSelection = await screen.findByText("testMic"); 37 expect(micSelection).toBeInTheDocument(); 38 39 const blurInput = await screen.findByText("Blur your background?"); 40 expect(blurInput).toBeInTheDocument(); 41 }); 42});