-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Unit Tests for VacancyStatus.js
- Loading branch information
1 parent
4c7fd98
commit 24a5a3d
Showing
1 changed file
with
65 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import VacancyStatus from './VacancyStatus'; | ||
|
||
// Mock window.matchMedia | ||
beforeEach(() => { | ||
window.matchMedia = window.matchMedia || function () { | ||
return { | ||
matches: false, | ||
addListener: function () { }, | ||
removeListener: function () { } | ||
}; | ||
}; | ||
}); | ||
|
||
describe('VacancyStatus Component', () => { | ||
it('renders without crashing', () => { | ||
const { container } = render(<VacancyStatus state="Triage" />); | ||
expect(container).toBeInTheDocument(); | ||
}); | ||
|
||
it('displays the correct step for Triage', () => { | ||
const { getByText } = render(<VacancyStatus state="Triage" />); | ||
expect(getByText('Triage')).toBeInTheDocument(); | ||
}); | ||
|
||
it('displays the correct step for Individual Scoring in Progress', () => { | ||
const { getByText } = render(<VacancyStatus state="Individual Scoring in Progress" />); | ||
expect(getByText('Individual Scoring')).toBeInTheDocument(); | ||
}); | ||
|
||
it('displays the correct step for Committee Review in Progress', () => { | ||
const { getByText } = render(<VacancyStatus state="Committee Review in Progress" />); | ||
expect(getByText('Committee Review')).toBeInTheDocument(); | ||
}); | ||
|
||
it('displays the correct step for Voting Complete', () => { | ||
const { getByText } = render(<VacancyStatus state="Voting Complete" />); | ||
expect(getByText('Voting Complete')).toBeInTheDocument(); | ||
}); | ||
|
||
it('sets the correct current step for Triage', () => { | ||
const { container } = render(<VacancyStatus state="Triage" />); | ||
const steps = container.querySelectorAll('.ant-steps-item'); | ||
expect(steps[0]).toHaveClass('ant-steps-item-active'); | ||
}); | ||
|
||
it('sets the correct current step for Individual Scoring in Progress', () => { | ||
const { container } = render(<VacancyStatus state="Individual Scoring in Progress" />); | ||
const steps = container.querySelectorAll('.ant-steps-item'); | ||
expect(steps[1]).toHaveClass('ant-steps-item-active'); | ||
}); | ||
|
||
it('sets the correct current step for Committee Review in Progress', () => { | ||
const { container } = render(<VacancyStatus state="Committee Review in Progress" />); | ||
const steps = container.querySelectorAll('.ant-steps-item'); | ||
expect(steps[2]).toHaveClass('ant-steps-item-active'); | ||
}); | ||
|
||
it('sets the correct current step for Voting Complete', () => { | ||
const { container } = render(<VacancyStatus state="Voting Complete" />); | ||
const steps = container.querySelectorAll('.ant-steps-item'); | ||
expect(steps[3]).toHaveClass('ant-steps-item-active'); | ||
}); | ||
}); |