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
7 changed files
with
216 additions
and
41 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
28 changes: 28 additions & 0 deletions
28
frontend/packages/console-shared/src/utils/__tests__/alert-utils.spec.ts
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 { | ||
mockAlerts, | ||
mockAlerts2, | ||
expectedFiringAlerts, | ||
} from '@console/shared/src/utils/__mocks__/alerts-and-rules-data'; | ||
import { AlertSeverity } from '@console/internal/components/monitoring/types'; | ||
import { | ||
getSeverityAlertType, | ||
getFiringAlerts, | ||
shouldHideMonitoringAlertDecorator, | ||
} from '../alert-utils'; | ||
|
||
describe('alert-utils', () => { | ||
it('should get firing alerts', () => { | ||
const firingAlerts = getFiringAlerts(mockAlerts.data); | ||
expect(firingAlerts).toEqual(expectedFiringAlerts); | ||
}); | ||
|
||
it('should fetch the severity of the most important alert', () => { | ||
const severityAlertType = getSeverityAlertType(mockAlerts.data); | ||
expect(severityAlertType).toEqual(AlertSeverity.Critical); | ||
}); | ||
it('should hide monitoring alert decorator for alerts having severity as info/none', () => { | ||
const severityAlertType = getSeverityAlertType(mockAlerts2); | ||
const hideMonitoringAlertDecorator = shouldHideMonitoringAlertDecorator(severityAlertType); | ||
expect(hideMonitoringAlertDecorator).toBe(true); | ||
}); | ||
}); |
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