query_aggregation_ctrl.test.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. import { StackdriverAggregationCtrl } from '../query_aggregation_ctrl';
  2. describe('StackdriverAggregationCtrl', () => {
  3. let ctrl;
  4. describe('aggregation and alignment options', () => {
  5. describe('when new query result is returned from the server', () => {
  6. describe('and result is double and gauge', () => {
  7. beforeEach(async () => {
  8. ctrl = new StackdriverAggregationCtrl({
  9. $on: () => {},
  10. target: { valueType: 'DOUBLE', metricKind: 'GAUGE', aggregation: { crossSeriesReducer: '' } },
  11. });
  12. });
  13. it('should populate all aggregate options except two', () => {
  14. ctrl.setAggOptions();
  15. expect(ctrl.$scope.aggOptions.length).toBe(11);
  16. expect(ctrl.$scope.aggOptions.map(o => o.value)).toEqual(
  17. expect['not'].arrayContaining(['REDUCE_COUNT_TRUE', 'REDUCE_COUNT_FALSE'])
  18. );
  19. });
  20. it('should populate all alignment options except two', () => {
  21. ctrl.setAlignOptions();
  22. expect(ctrl.$scope.alignOptions.length).toBe(10);
  23. expect(ctrl.$scope.alignOptions.map(o => o.value)).toEqual(
  24. expect['not'].arrayContaining(['REDUCE_COUNT_TRUE', 'REDUCE_COUNT_FALSE'])
  25. );
  26. });
  27. });
  28. });
  29. });
  30. });