Files
grafana/public/app/plugins/datasource/cloud-monitoring/functions.test.ts

39 lines
1.2 KiB
TypeScript
Raw Normal View History

2019-01-03 15:12:03 +01:00
import { getAlignmentOptionsByMetric } from './functions';
import { ValueTypes, MetricKind } from './types';
2019-01-03 15:12:03 +01:00
describe('functions', () => {
let result: any;
2019-01-03 15:12:03 +01:00
describe('getAlignmentOptionsByMetric', () => {
describe('when double and gauge is passed', () => {
beforeEach(() => {
result = getAlignmentOptionsByMetric(ValueTypes.DOUBLE, MetricKind.GAUGE);
});
it('should return all alignment options except two', () => {
expect(result.length).toBe(9);
expect(result.map((o: any) => o.value)).toEqual(
2019-01-03 15:12:03 +01:00
expect.not.arrayContaining(['REDUCE_COUNT_TRUE', 'REDUCE_COUNT_FALSE'])
);
});
});
describe('when double and delta is passed', () => {
beforeEach(() => {
result = getAlignmentOptionsByMetric(ValueTypes.DOUBLE, MetricKind.DELTA);
});
it('should return all alignment options except four', () => {
expect(result.length).toBe(9);
expect(result.map((o: any) => o.value)).toEqual(
2019-01-03 15:12:03 +01:00
expect.not.arrayContaining([
'ALIGN_COUNT_TRUE',
'ALIGN_COUNT_FALSE',
'ALIGN_FRACTION_TRUE',
'ALIGN_INTERPOLATE',
])
);
});
});
});
});