grafana/public/app/plugins/datasource/cloud-monitoring/functions.test.ts
Sofia Papagiannaki 4bb3f66569
Stackdriver: Rename Stackdriver to Google Cloud Monitoring (#25807)
* Update backend

* Update frontend

* Keep old plugin id

* Update docs

* Place doc images to a new directory

* Legacy support for stackdriver-auto alignment

* Consistent plugin name

* Apply suggestions from code review

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Co-authored-by: Tobias Skarhed <1438972+tskarhed@users.noreply.github.com>

* Update docs

* Update public/app/plugins/datasource/cloud-monitoring/README.md

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>

* Add reference to the data source formerly being named Stackdriver

* Update pkg/models/datasource.go

Co-authored-by: Carl Bergquist <carl@grafana.com>

* Fix gofmt

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Co-authored-by: Tobias Skarhed <1438972+tskarhed@users.noreply.github.com>
Co-authored-by: Carl Bergquist <carl@grafana.com>
2020-06-30 18:47:13 +03:00

39 lines
1.2 KiB
TypeScript

import { getAlignmentOptionsByMetric } from './functions';
import { ValueTypes, MetricKind } from './constants';
describe('functions', () => {
let result: any;
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(
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(
expect.not.arrayContaining([
'ALIGN_COUNT_TRUE',
'ALIGN_COUNT_FALSE',
'ALIGN_FRACTION_TRUE',
'ALIGN_INTERPOLATE',
])
);
});
});
});
});