generated from lighthouse-labs/scheduler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added mock functions for axios put and delete
Added more test for Application
- Loading branch information
1 parent
922e489
commit 48bdebe
Showing
4 changed files
with
47 additions
and
7 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,41 @@ | ||
import React from "react"; | ||
|
||
import { render, cleanup, waitForElement, fireEvent } from "@testing-library/react"; | ||
import { render, cleanup, waitForElement, fireEvent, getByText, prettyDOM, getAllByTestId, getByPlaceholderText, getByAltText, getAllByText} from "@testing-library/react"; | ||
|
||
import Application from "components/Application"; | ||
|
||
afterEach(cleanup); | ||
describe("Application", () => { | ||
it("changes the schedule when a new day is selected", async () => { | ||
const { getByText } = render(<Application />); | ||
|
||
it("changes the schedule when a new day is selected", async () => { | ||
const { getByText } = render(<Application />); | ||
await waitForElement(() => getByText("Monday")); | ||
|
||
await waitForElement(() => getByText("Monday")); | ||
fireEvent.click(getByText("Tuesday")); | ||
|
||
fireEvent.click(getByText("Tuesday")); | ||
expect(getByText("Leopold Silvers")).toBeInTheDocument(); | ||
}); | ||
|
||
expect(getByText("Leopold Silvers")).toBeInTheDocument(); | ||
it("loads data, books an interview and reduces the spots remaining for the first day by 1", async () => { | ||
const { container } = render(<Application />); | ||
|
||
await waitForElement(() => getByText(container, "Archie Cohen")); | ||
|
||
const appointments = getAllByTestId(container, "appointment"); | ||
const appointment = appointments[0]; | ||
|
||
fireEvent.click(getByAltText(appointment, "Add")); | ||
|
||
fireEvent.change(getByPlaceholderText(appointment, /enter student name/i), { | ||
target: { value: "Lydia Miller-Jones" } | ||
}); | ||
fireEvent.click(getByAltText(appointment, "Sylvia Palmer")); | ||
|
||
fireEvent.click(getByText(appointment, "Save")); | ||
// expect(getByText(appointment, "Saving")).toBeInTheDocument(); | ||
|
||
// await waitForElement(() => getByText(appointment, "Lydia Miller-Jones")); | ||
// getByText("Monday") | ||
console.log(prettyDOM(appointment)); | ||
}); | ||
}); |
File renamed without changes.