-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
213 additions
and
71 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
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
32 changes: 32 additions & 0 deletions
32
superset-frontend/src/features/alerts/components/RecipientIcon.test.tsx
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,32 @@ | ||
import { render, screen } from 'spec/helpers/testing-library'; | ||
import RecipientIcon from './RecipientIcon'; | ||
import { NotificationMethodOption } from '../types'; | ||
|
||
describe('RecipientIcon', () => { | ||
it('should render the email icon when type is Email', () => { | ||
render(<RecipientIcon type={NotificationMethodOption.Email} />); | ||
const regexPattern = new RegExp(NotificationMethodOption.Email, 'i'); | ||
const emailIcon = screen.getByLabelText(regexPattern); | ||
expect(emailIcon).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render the Slack icon when type is Slack', () => { | ||
render(<RecipientIcon type={NotificationMethodOption.Slack} />); | ||
const regexPattern = new RegExp(NotificationMethodOption.Slack, 'i'); | ||
const slackIcon = screen.getByLabelText(regexPattern); | ||
expect(slackIcon).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render the Slack icon when type is SlackV2', () => { | ||
render(<RecipientIcon type={NotificationMethodOption.SlackV2} />); | ||
const regexPattern = new RegExp(NotificationMethodOption.Slack, 'i'); | ||
const slackIcon = screen.getByLabelText(regexPattern); | ||
expect(slackIcon).toBeInTheDocument(); | ||
}); | ||
|
||
it('should not render any icon when type is not recognized', () => { | ||
render(<RecipientIcon type="unknown" />); | ||
const icons = screen.queryByLabelText(/.*/); | ||
expect(icons).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
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
Oops, something went wrong.