Skip to content

Commit

Permalink
Added Additional Tests for VacancyStatus.js coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
webbmj-nih committed Jan 21, 2025
1 parent 24a5a3d commit e937038
Showing 1 changed file with 84 additions and 38 deletions.
122 changes: 84 additions & 38 deletions src/components/UI/VacancyStatus/VacancyStatus.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,52 +14,98 @@ beforeEach(() => {
});

describe('VacancyStatus Component', () => {
it('renders without crashing', () => {
const { container } = render(<VacancyStatus state="Triage" />);
expect(container).toBeInTheDocument();
// Mock window.matchMedia
beforeEach(() => {
window.matchMedia = window.matchMedia || function () {
return {
matches: false,
addListener: function () { },
removeListener: function () { }
};
};
});

it('displays the correct step for Triage', () => {
const { getByText } = render(<VacancyStatus state="Triage" />);
expect(getByText('Triage')).toBeInTheDocument();
});
describe('VacancyStatus Component', () => {
it('renders without crashing', () => {
const { container } = render(<VacancyStatus state="Triage" />);
expect(container).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 Triage', () => {
const { getByText } = render(<VacancyStatus state="Triage" />);
expect(getByText('Triage')).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 Chair Triage', () => {
const { getByText } = render(<VacancyStatus state="Chair Triage" />);
expect(getByText('Triage')).toBeInTheDocument();
});

it('displays the correct step for Voting Complete', () => {
const { getByText } = render(<VacancyStatus state="Voting Complete" />);
expect(getByText('Voting Complete')).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('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('displays the correct step for Individual Scoring Complete', () => {
const { getByText } = render(<VacancyStatus state="Individual Scoring Complete" />);
expect(getByText('Individual Scoring')).toBeInTheDocument();
});

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('displays the correct step for Committee Review in Progress', () => {
const { getByText } = render(<VacancyStatus state="Committee Review in Progress" />);
expect(getByText('Committee Review')).toBeInTheDocument();
});

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('displays the correct step for Committee Review Complete', () => {
const { getByText } = render(<VacancyStatus state="Committee Review Complete" />);
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 Chair Triage', () => {
const { container } = render(<VacancyStatus state="Chair 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 Individual Scoring Complete', () => {
const { container } = render(<VacancyStatus state="Individual Scoring Complete" />);
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 Committee Review Complete', () => {
const { container } = render(<VacancyStatus state="Committee Review Complete" />);
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');
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');
});
});
});

0 comments on commit e937038

Please sign in to comment.