-
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 pull request #271 from COS301-SE-2024/feat/web/Dashboard-Creation
Feat/web/dashboard creation
- Loading branch information
Showing
39 changed files
with
1,807 additions
and
767 deletions.
There are no files selected for viewing
Binary file not shown.
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
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 was deleted.
Oops, something went wrong.
20 changes: 7 additions & 13 deletions
20
frontend/occupi-web/src/components/OverviewComponent/Overview.test.tsx
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
59 changes: 59 additions & 0 deletions
59
frontend/occupi-web/src/components/aiDashboard/aiDashCard/AiDashCard.test.tsx
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,59 @@ | ||
import { expect, test, mock } from "bun:test"; | ||
import { render,cleanup } from "@testing-library/react"; | ||
import {AiDashCard} from "@components/index"; | ||
import { afterEach } from "bun:test"; | ||
|
||
|
||
afterEach(() => { | ||
cleanup(); | ||
}); | ||
|
||
test("AiDashCard renders correctly", () => { | ||
const mockProps = { | ||
title: "Test Card", | ||
icon: <div>Icon</div>, | ||
stat: "100", | ||
trend: 5, | ||
onRemove: mock(() => {}), | ||
}; | ||
|
||
const { getByText } = render(<AiDashCard {...mockProps} />); | ||
|
||
expect(getByText("Test Card")).toBeDefined(); | ||
expect(getByText("100")).toBeDefined(); | ||
expect(getByText("5% Since last month")).toBeDefined(); | ||
}); | ||
|
||
|
||
|
||
test("AiDashCard calls onRemove when close button is clicked", () => { | ||
const mockOnRemove = mock(() => {}); | ||
const mockProps = { | ||
title: "Test Card", | ||
icon: <div>Icon</div>, | ||
stat: "100", | ||
trend: 5, | ||
onRemove: mockOnRemove, | ||
}; | ||
|
||
const { getByText } = render(<AiDashCard {...mockProps} />); | ||
const closeButton = getByText("×"); | ||
closeButton.click(); | ||
|
||
expect(mockOnRemove).toHaveBeenCalled(); | ||
}); | ||
|
||
test("AiDashCard displays negative trend correctly", () => { | ||
const mockProps = { | ||
title: "Test Card", | ||
icon: <div>Icon</div>, | ||
stat: "100", | ||
trend: -5, | ||
onRemove: mock(() => {}), | ||
}; | ||
|
||
const { getByText } = render(<AiDashCard {...mockProps} />); | ||
|
||
expect(getByText("5% Since last month")).toBeDefined(); | ||
}); | ||
|
Oops, something went wrong.