-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add icons to health status indicators (#677)
* Add icons to health status indicators * Add Jest test for HealthIcon component
- Loading branch information
Showing
4 changed files
with
43 additions
and
26 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,28 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import '@testing-library/jest-dom'; | ||
|
||
import HealthIcon from './'; | ||
|
||
describe('HealthIcon', () => { | ||
it('should display a green svg when the health is passing', () => { | ||
const { container } = render(<HealthIcon health={'passing'} />); | ||
const svgEl = container.querySelector("[data-testid='eos-svg-component']"); | ||
expect(svgEl.classList.toString()).toContain('fill-jungle-green-500'); | ||
}); | ||
it('should display a yellow svg when the health is warning', () => { | ||
const { container } = render(<HealthIcon health={'warning'} />); | ||
const svgEl = container.querySelector("[data-testid='eos-svg-component']"); | ||
expect(svgEl.classList.toString()).toContain('fill-yellow-500'); | ||
}); | ||
it('should display a red svg when the health is critical', () => { | ||
const { container } = render(<HealthIcon health={'critical'} />); | ||
const svgEl = container.querySelector("[data-testid='eos-svg-component']"); | ||
expect(svgEl.classList.toString()).toContain('fill-red-500'); | ||
}); | ||
it('should display a grey circle when the health is unknown', () => { | ||
const { container } = render(<HealthIcon health={''} />); | ||
const svgEl = container.querySelector("[data-testid='eos-svg-component']"); | ||
expect(svgEl.classList.toString()).toContain('fill-gray-500'); | ||
}); | ||
}); |
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