-
Notifications
You must be signed in to change notification settings - Fork 1
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 #242 from wizelineacademy/dev
Dev
- Loading branch information
Showing
15 changed files
with
222 additions
and
25 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
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,37 @@ | ||
import React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import { describe, it, expect } from "vitest"; | ||
import NoDataCard from "@/components/NoDataCard"; | ||
|
||
describe("NoDataCard Component", () => { | ||
// José Eduardo de Valle Lara A01734957 - Test #6/10 | ||
it("renders correctly with provided text", () => { | ||
const testText = "No data available"; | ||
render(<NoDataCard text={testText} />); | ||
|
||
const textElement = screen.getByText(testText); | ||
expect(textElement).toBeInTheDocument(); | ||
expect(textElement).toHaveClass( | ||
"text-center text-sm font-medium text-grayText", | ||
); | ||
}); | ||
|
||
// José Eduardo de Valle Lara A01734957 - Test #7/10 | ||
it("renders image on medium and larger screens", () => { | ||
render(<NoDataCard text="No data available" />); | ||
|
||
const imageElement = screen.getByAltText("NoDataSVG"); | ||
expect(imageElement).toBeInTheDocument(); | ||
expect(imageElement).toHaveClass("hidden md:block"); | ||
}); | ||
|
||
// José Eduardo de Valle Lara A01734957 - Test #8/10 | ||
it("contains the provided text", () => { | ||
const testText = "No data available"; | ||
render(<NoDataCard text={testText} />); | ||
|
||
const textElement = screen.getByText(testText); | ||
expect(textElement).toBeInTheDocument(); | ||
expect(textElement).toHaveTextContent(testText); | ||
}); | ||
}); |
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,39 @@ | ||
import React from "react"; | ||
import { render, screen, fireEvent } from "@testing-library/react"; | ||
import { describe, it, expect, vi } from "vitest"; | ||
import Slider from "@/components/Slider"; | ||
|
||
describe("Slider Component", () => { | ||
// José Eduardo de Valle Lara A01734957 - Test #9/10 | ||
it("renders correctly with provided props", () => { | ||
render(<Slider label="Test Label" name="testSlider" />); | ||
|
||
expect(screen.getByText("Test Label")).toBeInTheDocument(); | ||
expect(screen.getByTestId("slider-testSlider")).toBeInTheDocument(); | ||
expect(screen.getByTestId("input-slider")).toBeInTheDocument(); | ||
}); | ||
|
||
// José Eduardo de Valle Lara A01734957 - Test #10/10 | ||
it("changes value when interacted with", () => { | ||
render(<Slider label="Test Label" name="testSlider" />); | ||
|
||
const slider = screen.getByTestId("input-slider") as HTMLInputElement; | ||
fireEvent.change(slider, { target: { value: 5 } }); | ||
|
||
expect(slider.value).toBe("5"); | ||
}); | ||
|
||
// José Eduardo de Valle Lara A01734957 - Test #11/10 | ||
it("calls onChange with correct parameters", () => { | ||
const handleChange = vi.fn(); | ||
render( | ||
<Slider label="Test Label" name="testSlider" onChange={handleChange} />, | ||
); | ||
|
||
const slider = screen.getByTestId("input-slider") as HTMLInputElement; | ||
fireEvent.change(slider, { target: { value: 7 } }); | ||
|
||
expect(handleChange).toHaveBeenCalledWith(expect.any(Object), "testSlider"); | ||
expect(handleChange).toHaveBeenCalledTimes(1); | ||
}); | ||
}); |