-
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.
Added testing to ensure StepTimeDigits has the correct structure. Added testing to ensure initial values for target zones and step time are correctly rendered.
- Loading branch information
1 parent
84f07e2
commit cafd478
Showing
2 changed files
with
62 additions
and
7 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,55 @@ | ||
import { render, screen } from "@testing-library/react"; | ||
import StepTimeDigits from "../StepTimeDigits"; | ||
|
||
describe("Step Time View Structure", () => { | ||
const testStepTime = { | ||
left: 0, | ||
right: 0, | ||
targetZones: { | ||
left: {min: 0, max:0}, | ||
right: {min: 0, max:0}, | ||
}, | ||
}; | ||
|
||
test("Target Zone Structure Correctly Rendered", () => { | ||
render(<StepTimeDigits stepTime={testStepTime} />); | ||
expect(screen.getByTestId('target-zones-values')).toBeInTheDocument(); | ||
expect(screen.getByTestId('target-zones-title')).toBeInTheDocument(); | ||
expect(screen.getByTestId('target-zones-left')).toBeInTheDocument(); | ||
expect(screen.getByTestId('target-zones-right')).toBeInTheDocument(); | ||
}); | ||
|
||
test("Step Time Value Structure Correctly Rendered", () => { | ||
render(<StepTimeDigits stepTime={testStepTime} />); | ||
expect(screen.getByTestId('current-step-time-values')).toBeInTheDocument(); | ||
expect(screen.getByTestId('current-step-time-left')).toBeInTheDocument(); | ||
expect(screen.getByTestId('current-step-time-right')).toBeInTheDocument(); | ||
}); | ||
}); | ||
|
||
describe("Step Time Data", () => { | ||
let testStepTime; | ||
|
||
beforeEach(() => { | ||
testStepTime = { | ||
left: 12, | ||
right: 27, | ||
targetZones: { | ||
left: {min: 5, max: 10}, | ||
right: {min: 3, max: 20}, | ||
}, | ||
}; | ||
}); | ||
|
||
test("Initial Target Zones correctly rendered", () => { | ||
render(<StepTimeDigits stepTime={testStepTime}/>); | ||
expect(screen.getByTestId('target-zones-left').textContent).toBe('5-10'); | ||
expect(screen.getByTestId('target-zones-right').textContent).toBe('3-20'); | ||
}); | ||
|
||
test("Initial Current Step Time Values correctly rendered", () => { | ||
render(<StepTimeDigits stepTime={testStepTime}/>); | ||
expect(screen.getByTestId('current-step-time-left').textContent).toBe('12'); | ||
expect(screen.getByTestId('current-step-time-right').textContent).toBe('27'); | ||
}); | ||
}); |