From 2a25d35084cb04699818ba5bebff834da67dbf34 Mon Sep 17 00:00:00 2001 From: Akanksha Date: Sat, 7 Oct 2023 11:41:11 +0530 Subject: [PATCH] Fix: Add unit tests --- __tests__/Answer.test.js | 13 +++++++++++ __tests__/Footer.test.js | 14 ++++++++++++ __tests__/Question.test.js | 13 +++++++++++ __tests__/QueueSection.test.js | 39 +++++++++++++++++++++++++++++++++ __tests__/ShowQueue.test.js | 35 +++++++++++++++++++++++++++++ __tests__/UploadedItems.test.js | 28 +++++++++++++++++++++++ jest.config.js | 10 +++++++++ package.json | 8 ++++++- 8 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 __tests__/Answer.test.js create mode 100644 __tests__/Footer.test.js create mode 100644 __tests__/Question.test.js create mode 100644 __tests__/QueueSection.test.js create mode 100644 __tests__/ShowQueue.test.js create mode 100644 __tests__/UploadedItems.test.js create mode 100644 jest.config.js diff --git a/__tests__/Answer.test.js b/__tests__/Answer.test.js new file mode 100644 index 0000000..a9b79b6 --- /dev/null +++ b/__tests__/Answer.test.js @@ -0,0 +1,13 @@ +import React from "react"; +import { render } from "@testing-library/react"; +import Answer from "../components/Answer"; +import "@testing-library/jest-dom"; + +describe("Answer component", () => { + it("should render the text correctly", () => { + const text = "This is the answer text"; + const { getByText } = render(); + const answerElement = getByText(text); + expect(answerElement).toBeInTheDocument(); + }); +}); diff --git a/__tests__/Footer.test.js b/__tests__/Footer.test.js new file mode 100644 index 0000000..2fefc56 --- /dev/null +++ b/__tests__/Footer.test.js @@ -0,0 +1,14 @@ +import React from "react"; +import { render, screen } from "@testing-library/react"; +import Footer from "../components/Footer"; +import "@testing-library/jest-dom"; + +describe("Footer Component", () => { + it("should render the footer text", () => { + render(