-
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.
Merge branch 'main' of github.com:392-f24/FitForecast
- Loading branch information
Showing
3 changed files
with
91 additions
and
31 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
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 { render, screen } from "@testing-library/react"; | ||
import { describe, it, vi, expect } from "vitest"; | ||
import SuggestedOutfit from "./SuggestedOutfit"; | ||
import { MemoryRouter } from "react-router-dom"; | ||
|
||
// Mock Firebase auth | ||
vi.mock("../utilities/firebase", () => ({ | ||
auth: { | ||
currentUser: { uid: "testUserId" }, | ||
}, | ||
})); | ||
|
||
// Mock the getSuggestedOutfit function | ||
vi.mock("../utilities/functions", () => ({ | ||
getSuggestedOutfit: vi.fn(() => | ||
Promise.resolve({ | ||
top: "", | ||
bottom: "", | ||
outerwear: "", | ||
footwear: "", | ||
}) | ||
), | ||
})); | ||
|
||
describe("SuggestedOutfit Component", () => { | ||
it("displays a message asking the user to add clothes when no clothes are in the closet", async () => { | ||
const mockWeatherData = { temp: 20 }; // Example weather data | ||
const mockWeatherError = null; | ||
|
||
render( | ||
<MemoryRouter> | ||
<SuggestedOutfit | ||
weatherData={mockWeatherData} | ||
weatherError={mockWeatherError} | ||
/> | ||
</MemoryRouter> | ||
); | ||
|
||
// Wait for the outfit loading to finish | ||
const messageElement = await screen.findByText( | ||
/Add more clothes to get an outfit suggestion!/i | ||
); | ||
|
||
// Check if the message is displayed | ||
expect(messageElement).toBeInTheDocument(); | ||
}); | ||
}); |
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