-
Notifications
You must be signed in to change notification settings - Fork 8
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 #826 from securityscorecard/ajkl2533@UXD-1255
fix(Signal): handle unknown value gracefully
- Loading branch information
Showing
2 changed files
with
43 additions
and
2 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,36 @@ | ||
import { screen } from '@testing-library/react'; | ||
import React from 'react'; | ||
|
||
import { renderWithProviders } from '../../utils/tests/renderWithProviders'; | ||
import { Signal } from './index'; | ||
|
||
describe('Signal', () => { | ||
it('should not render if empty "kind" prop is provided', () => { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
renderWithProviders(<Signal kind="" />); | ||
|
||
expect(screen.queryByTestId('ds-severity-icon')).not.toBeInTheDocument(); | ||
}); | ||
it('should not render if "kind" prop is null', () => { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
renderWithProviders(<Signal kind={null} />); | ||
|
||
expect(screen.queryByTestId('ds-severity-icon')).not.toBeInTheDocument(); | ||
}); | ||
it('should not render if "kind" prop is undefined', () => { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
renderWithProviders(<Signal kind={undefined} />); | ||
|
||
expect(screen.queryByTestId('ds-severity-icon')).not.toBeInTheDocument(); | ||
}); | ||
it('should not render if unknown "kind" prop is provided', () => { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
renderWithProviders(<Signal kind="strange" />); | ||
|
||
expect(screen.queryByTestId('ds-severity-icon')).not.toBeInTheDocument(); | ||
}); | ||
}); |
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