-
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.
- Loading branch information
1 parent
ea5dd30
commit bde7a05
Showing
1 changed file
with
47 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from "react"; | ||
// The React testing library simulates the DOM. | ||
import { render, screen, fireEvent } from "@testing-library/react"; | ||
import Login from "./login"; | ||
import Register from "./Register"; | ||
import Viewsong from "./Viewsong"; | ||
import Songdisplay from "./Songdisplay.js"; | ||
import Updatesong from "./Updatesong"; | ||
import Deletesong from "./Deletesong"; | ||
import Createsong from "./Createsong"; | ||
import { BrowserRouter } from "react-router-dom"; | ||
// The jest-dom lets you analyze the rendered simulation. | ||
import "@testing-library/jest-dom"; | ||
|
||
// Rendering test for the register page | ||
test("Register Login", () => { | ||
render( | ||
<BrowserRouter> | ||
<Register /> | ||
</BrowserRouter> | ||
); | ||
|
||
const usernameInput = screen.getByPlaceholderText("Username"); | ||
const passwordInput = screen.getByPlaceholderText("Password"); | ||
const registerButton = screen.getByRole("button", { name: /Register/i }); | ||
|
||
expect(usernameInput).toBeInTheDocument(); | ||
expect(passwordInput).toBeInTheDocument(); | ||
expect(registerButton).toBeInTheDocument(); | ||
}); | ||
|
||
// Rendering test for the register page | ||
test("Register Rendering", () => { | ||
render( | ||
<BrowserRouter> | ||
<Register /> | ||
</BrowserRouter> | ||
); | ||
|
||
const usernameInput = screen.getByPlaceholderText("Username"); | ||
const passwordInput = screen.getByPlaceholderText("Password"); | ||
const confirmPasswordInput = screen.getByPlaceholderText("Confirm Password"); | ||
|
||
expect(usernameInput).toBeInTheDocument(); | ||
expect(passwordInput).toBeInTheDocument(); | ||
expect(confirmPasswordInput).toBeInTheDocument(); | ||
}); |