Skip to content

Commit

Permalink
ishavarrier - intro task (#27)
Browse files Browse the repository at this point in the history
* commiting button and tests

* added linkedin

---------

Co-authored-by: Isha Varrier <ishavarrier@Ishas-MacBook-Air.local>
Co-authored-by: Ryan Chan <91078767+ryanchansf@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 22, 2025
1 parent 098323d commit 891bd27
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ The Surfrider team consists of 15 Cal Poly students. Over the course of about 9
- [Edrick Wong](https://www.linkedin.com/) - Designer
- [Nickaan Jahadi](https://www.linkedin.com/in/nickaanjahadi2410/) - Software Developer
- [Ivan Torriani](https://www.linkedin.com/in/ivan-torriani-3b875a331/) - Software Developer
- [Isha Varrier](https://www.linkedin.com/in/isha-varrier/) - Software Developer

## Getting Started And Contributing

Expand Down
17 changes: 17 additions & 0 deletions src/app/ishavarrier/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"use client";
import React, { useState } from "react";
import { Button } from "@/components/ui/button";

export default function IshaVarrier() {
const [count, setCount] = useState(0);
const handleClick = () => {
setCount(count + 1);
};

return (
<div className="flex flex-col items-center justify-center h-screen">
<h1>Count Value: {count}</h1>
<Button onClick={handleClick}>Click to Increment Count</Button>
</div>
);
}
31 changes: 31 additions & 0 deletions test/app/ishavarrier/page.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/** @jest-environment jsdom */
import IshaVarrier from "@/app/ishavarrier/page";
import "@testing-library/jest-dom";
import { render, screen } from "@testing-library/react";
import { fireEvent } from "@testing-library/react";

describe("Button Component", () => {
it("should render the button component", () => {
render(<IshaVarrier />);

const button = screen.getByRole("button");
expect(button).toHaveTextContent("Click to Increment Count");
});

it("should render the heading component to display count", () => {
render(<IshaVarrier />);

expect(screen.getByText("Count Value: 0")).toBeInTheDocument();
});

it("should increment the count when button is clicked", () => {
render(<IshaVarrier />);

const button = screen.getByRole("button");
fireEvent.click(button);
fireEvent.click(button);
fireEvent.click(button);

expect(screen.getByText("Count Value: 3")).toBeInTheDocument();
});
});

0 comments on commit 891bd27

Please sign in to comment.