mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Add function to check if a datasource is managing alerts * Use helper function to get datasources that manage alerts
40 lines
829 B
TypeScript
40 lines
829 B
TypeScript
import { mockDataSource } from '../mocks';
|
|
|
|
import { isDataSourceManagingAlerts } from './datasource';
|
|
|
|
describe('isDataSourceManagingAlerts', () => {
|
|
it('should return true when the prop is set as true', () => {
|
|
expect(
|
|
isDataSourceManagingAlerts(
|
|
mockDataSource({
|
|
jsonData: {
|
|
manageAlerts: true,
|
|
},
|
|
})
|
|
)
|
|
).toBe(true);
|
|
});
|
|
|
|
it('should return true when the prop is undefined', () => {
|
|
expect(
|
|
isDataSourceManagingAlerts(
|
|
mockDataSource({
|
|
jsonData: {},
|
|
})
|
|
)
|
|
).toBe(true);
|
|
});
|
|
});
|
|
|
|
it('should return false when the prop is set as false', () => {
|
|
expect(
|
|
isDataSourceManagingAlerts(
|
|
mockDataSource({
|
|
jsonData: {
|
|
manageAlerts: false,
|
|
},
|
|
})
|
|
)
|
|
).toBe(false);
|
|
});
|