Created
July 17, 2024 23:55
-
-
Save ProfAvery/c3e69ff4364f4f9d67f6afcb585565ee to your computer and use it in GitHub Desktop.
Updated Listing 8-26 - Summer 2024 AMSE Bootcamp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @jest-environment jsdom | |
*/ | |
import { act, render, fireEvent } from "@testing-library/react"; | |
import PageComponentWeather from "../../../pages/components/weather"; | |
describe("PageComponentWeather", () => { | |
test("renders correctly", async () => { | |
let component: any; | |
await act(async () => { | |
component = | |
await render(<PageComponentWeather></PageComponentWeather>); | |
}); | |
expect(component.asFragment()).toMatchSnapshot(); | |
}); | |
test("clicks the h1 element and updates the state", async () => { | |
let component: any; | |
await act(async () => { | |
component = await render(<PageComponentWeather></PageComponentWeather>); | |
}); | |
fireEvent.click(component.container.querySelector("h1")); | |
expect(component.asFragment()).toMatchSnapshot(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment