From 3623b7560960c7f3c5348caf80cddf9397e68b3f Mon Sep 17 00:00:00 2001 From: VihaanShah26 Date: Thu, 7 Nov 2024 20:34:09 -0600 Subject: [PATCH] Testing --- gitlog.txt | 159 ++++++++++++++++++++++++++++++++++++++ src/App.test.jsx | 21 ++--- src/Cafes_Nearby.test.jsx | 47 +++++++++++ 3 files changed, 218 insertions(+), 9 deletions(-) create mode 100644 gitlog.txt create mode 100644 src/Cafes_Nearby.test.jsx diff --git a/gitlog.txt b/gitlog.txt new file mode 100644 index 0000000..80d2d39 --- /dev/null +++ b/gitlog.txt @@ -0,0 +1,159 @@ +commit 76691be778d2bafc4daaf51c3d1396704c9ed966 +Author: angelp03 +Date: Fri Nov 1 13:33:40 2024 -0500 + + remove sockets and initialize app + +M src/App.jsx +M src/utilities/firebase.js + +commit 9a6cff22474def7b66c8e84650446e15f485d2cb +Author: Mark Fortes +Date: Wed Oct 30 15:36:41 2024 -0500 + + use admin for server side + +M functions/index.js +M package-lock.json +M package.json + +commit e4d1085172b6be70c11556d3f3b7b62f4cb90509 +Author: Mark Fortes +Date: Wed Oct 30 15:30:59 2024 -0500 + + fixed import + +M functions/index.js + +commit c7d7f7a412dc284884d533197ce42687a6995dca +Author: Mark Fortes +Date: Wed Oct 30 15:28:08 2024 -0500 + + refactored to functions/index.js + +M functions/index.js +D src/server.js + +commit 756f157e5e878a0fe9d628954ef71e4c0d693640 +Author: Mark Fortes +Date: Wed Oct 30 15:17:11 2024 -0500 + + firebase functions implementation + +M firebase.json +A functions/.gitignore +A functions/index.js +A functions/package-lock.json +A functions/package.json +M src/server.js + +commit 3bba338e34c8752e343c8ee6d0141ff0d778e0d7 +Author: Mark Fortes +Date: Wed Oct 30 13:29:36 2024 -0500 + + updated socket url to live site + +M src/App.jsx + +commit ee3647a747517158688c307a9ab818764c096cfd +Author: Mark Fortes +Date: Wed Oct 30 13:27:10 2024 -0500 + + added cors for live site + +M src/server.js + +commit f36e9f313789057bd565795602748670a1a35780 +Author: Mark Fortes +Date: Mon Oct 28 15:12:06 2024 -0500 + + changed hosting pointer + +M firebase.json + +commit 4100fb4ae9927e4af298ef46c8ad58f599765965 +Author: Mark Fortes +Date: Mon Oct 28 14:36:18 2024 -0500 + + connect socket.io to firebase + +M src/server.js +M src/utilities/firebase.js + +commit ff6fd01e7fb373e8bd9b9cddb884121bf978683f +Author: Mark Fortes +Date: Mon Oct 28 14:35:57 2024 -0500 + + restored ui stuff + +M firebase.json +M index.html +M public/favicon.svg +M src/App.css +M src/App.jsx +M src/index.css + +commit 024cd55824e452a1e17f14fc9bcad5b1b771dda0 +Author: Mark Fortes +Date: Mon Oct 28 14:18:26 2024 -0500 + + fixed rewrite + +M firebase.json + +commit 1a0706fe597530003861395e76c82953ff7743af +Author: Mark Fortes +Date: Mon Oct 28 14:04:59 2024 -0500 + + firebase + +A .firebaserc +A database.rules.json +A firebase.json +M package-lock.json +M package.json +A public/index.html +A src/utilities/firebase.js + +commit fd0c8277abb3dbbdd43e15babbca91f672153bd6 +Author: VihaanShah26 +Date: Sun Oct 27 23:38:51 2024 -0500 + + Cafes nearby + +M index.html +M src/App.jsx + +commit b3788e337fa7fe22b10427f6e48cbc81783559d5 +Author: alizenart <97767073+alizenart@users.noreply.github.com> +Date: Sun Oct 27 18:16:50 2024 -0500 + + Live timing server + +M package-lock.json +M package.json +M src/App.css +M src/App.jsx +A src/server.js + +commit 590a6bfeeb054a8692dfbfe644f5b6555e488af4 +Author: angelp03 +Date: Tue Oct 22 22:20:49 2024 -0500 + + Initialize app + +A .gitignore +A LICENSE +A README.md +A index.html +A package-lock.json +A package.json +A public/favicon.svg +A public/robots.txt +A src/App.css +A src/App.jsx +A src/App.test.jsx +A src/index.css +A src/index.jsx +A src/logo.svg +A vite.config.js diff --git a/src/App.test.jsx b/src/App.test.jsx index 6820dcc..49947b9 100644 --- a/src/App.test.jsx +++ b/src/App.test.jsx @@ -2,18 +2,21 @@ import {describe, expect, test} from 'vitest'; import {fireEvent, render, screen} from '@testing-library/react'; import App from './App'; -describe('counter tests', () => { - - test("Counter should be 0 at the start", () => { +describe('launching', () => { + it('should show all the headings', async () => { render(); - expect(screen.getByText('count is: 0')).toBeDefined(); + await screen.findByText(/CafeWay/); + await screen.findByText(/Update Cafe Availability/); + await screen.findByText(/Availability History/); + await screen.findByText(/Cafes Near Me/); }); +}); - test("Counter should increment by one when clicked", async () => { + +describe('authenticating', () => { + it('show sign in/sign out button', async () => { render(); - const counter = screen.getByRole('button'); - fireEvent.click(counter); - expect(await screen.getByText('count is: 1')).toBeDefined(); + await screen.findByText(/Sign In/) || await screen.findByText(/Sign Out/); }); +}); -}); \ No newline at end of file diff --git a/src/Cafes_Nearby.test.jsx b/src/Cafes_Nearby.test.jsx new file mode 100644 index 0000000..b837d92 --- /dev/null +++ b/src/Cafes_Nearby.test.jsx @@ -0,0 +1,47 @@ +import {describe, it, vi} from 'vitest'; +import {render, screen} from '@testing-library/react'; +import App from './App'; +import { findCafes } from './utilities/findCafes'; + +const mockCafes = [ + "Bennison's Bakery", + "Peet's Coffee", + "Unicorn Cafe", + "McDonald's", + "Sarkis Cafe", + "Brothers K Coffeehouse", + "Kush Hookah Lounge", + "Starbucks", + "Curt's Café", + "Alchemy Coffee & Bake House", + "Coffee Lab Roasters & Asian Bake Shop | Filipino, Japanese, & European Pastries", + "Evanston Games & Cafe", + "Kung Fu Tea", + "Cupitol Coffee & Eatery (Evanston)", + "Pâtisserie Coralie", + "Starbucks", + "FRÍO Gelato - Evanston", + "Starbucks", + "Einstein Bros. Bagels", + "Panera Bread" +] + +vi.mock('./utilities/findCafes'); + +beforeEach(() => { + findCafes.mockReturnValue(mockCafes); + }); + + afterEach(() => { + vi.resetAllMocks(); + }); + + describe('finding cafes within 2 miles of 60201', () => { + it('should show all cafes within 2 miles of zip code 60201', () => { + render(); + screen.findByText(/Kung Fu Tea/); + screen.findByText(/Starbucks/); + screen.findByText(/Panera Bread/); + }); + }); + \ No newline at end of file