Files
grafana/public/app/features/alerting/unified/utils/datasource.test.ts
Virginia Cepeda 329d940448 Alerting: fix condition to distinguish multiple datasources type in dropdown (#67065)
* Add function to check if a datasource is managing alerts

* Use helper function to get datasources that manage alerts
2023-04-21 14:27:39 -03:00

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);
});