Skip to content

Commit

Permalink
timeline and popup test
Browse files Browse the repository at this point in the history
  • Loading branch information
ashnarazdan123 committed Nov 2, 2023
1 parent 51d375c commit 9140b62
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
4 changes: 2 additions & 2 deletions digital-memory-book/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import "bootstrap/dist/css/bootstrap.min.css";
function App() {
return (
<BrowserRouter>
<NavbarTop/>
<NavbarTop />
<Routes>
<Route path="/" element={<Home />}
<Route path="/" element={<Home />} />
<Route path="/registration" element={<Registration />} />
<Route path="/login" element={<Login />} />
<Route path="/contactus" element={<ContactUs />} />
Expand Down
26 changes: 26 additions & 0 deletions digital-memory-book/src/DigitalTimeline.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from "react";
import { render, fireEvent } from "@testing-library/react";
import { MemoryRouter } from "react-router-dom";
import DigitalTimeline from "./DigitalTimeline";

describe("DigitalTimeline component", () => {
it("renders the timeline and clicks modal", () => {
const { getByText, getByPlaceholderText } = render(
<MemoryRouter>
<DigitalTimeline />
</MemoryRouter>
);

const button = getByText("Create New Timeline");
expect(button).toBeInTheDocument();
fireEvent.click(button);

const modal = getByText("Enter the name of your new timeline!");
expect(modal).toBeInTheDocument();

const nameInput = getByPlaceholderText("Timeline Name");
fireEvent.change(nameInput, { target: { value: "timelineName" } });
const saveButton = getByText("Save");
fireEvent.click(saveButton);
});
});

0 comments on commit 9140b62

Please sign in to comment.