query_aggregation_ctrl.test.ts 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. // const StackdriverAggregationCtrl = ({}, {}) => {};
  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 and no group by is used', () => {
  7. // beforeEach(async () => {
  8. // ctrl = new StackdriverAggregationCtrl(
  9. // {
  10. // $on: () => {},
  11. // target: {
  12. // valueType: 'DOUBLE',
  13. // metricKind: 'GAUGE',
  14. // crossSeriesReducer: '',
  15. // groupBys: [],
  16. // },
  17. // },
  18. // {
  19. // replace: s => s,
  20. // variables: [{ name: 'someVariable1' }, { name: 'someVariable2' }],
  21. // }
  22. // );
  23. // });
  24. // it('should populate all aggregate options except two', () => {
  25. // ctrl.setAggOptions();
  26. // expect(ctrl.aggOptions.length).toBe(2);
  27. // const [templateVariableGroup, aggOptionsGroup] = ctrl.aggOptions;
  28. // expect(templateVariableGroup.options.length).toBe(2);
  29. // expect['not'].arrayContaining(['REDUCE_COUNT_TRUE', 'REDUCE_COUNT_FALSE'])
  30. // );
  31. // });
  32. // it('should populate all alignment options except two', () => {
  33. // ctrl.setAlignOptions();
  34. // const [templateVariableGroup, alignOptionGroup] = ctrl.aggOptions;
  35. // expect(templateVariableGroup.options.length).toBe(2);
  36. // expect(alignOptionGroup.options.length).toBe(11);
  37. // expect(alignOptionGroup.options.map(o => o.value)).toEqual(
  38. // expect['not'].arrayContaining(['REDUCE_COUNT_TRUE', 'REDUCE_COUNT_FALSE'])
  39. // );
  40. // });
  41. // });
  42. // describe('and result is double and delta and no group by is used', () => {
  43. // beforeEach(async () => {
  44. // ctrl = new StackdriverAggregationCtrl(
  45. // {
  46. // $on: () => {},
  47. // target: {
  48. // valueType: 'DOUBLE',
  49. // metricKind: 'DELTA',
  50. // crossSeriesReducer: '',
  51. // groupBys: [],
  52. // },
  53. // },
  54. // {
  55. // replace: s => s,
  56. // variables: [{ name: 'someVariable1' }, { name: 'someVariable2' }],
  57. // }
  58. // );
  59. // });
  60. // it('should populate all alignment options except four', () => {
  61. // ctrl.setAlignOptions();
  62. // const [templateVariableGroup, alignOptionGroup] = ctrl.alignOptions;
  63. // expect(templateVariableGroup.options.length).toBe(2);
  64. // expect(alignOptionGroup.options.length).toBe(9);
  65. // expect(alignOptionGroup.options.map(o => o.value)).toEqual(
  66. // expect['not'].arrayContaining([
  67. // 'ALIGN_NEXT_OLDER',
  68. // 'ALIGN_INTERPOLATE',
  69. // 'ALIGN_COUNT_TRUE',
  70. // 'ALIGN_COUNT_FALSE',
  71. // 'ALIGN_FRACTION_TRUE',
  72. // ])
  73. // );
  74. // });
  75. // });
  76. // describe('and result is double and gauge and a group by is used', () => {
  77. // beforeEach(async () => {
  78. // ctrl = new StackdriverAggregationCtrl(
  79. // {
  80. // $on: () => {},
  81. // target: {
  82. // valueType: 'DOUBLE',
  83. // metricKind: 'GAUGE',
  84. // crossSeriesReducer: 'REDUCE_NONE',
  85. // groupBys: ['resource.label.projectid'],
  86. // },
  87. // },
  88. // {
  89. // replace: s => s,
  90. // variables: [{ name: 'someVariable1' }],
  91. // }
  92. // );
  93. // });
  94. // it('should populate all aggregate options except three', () => {
  95. // ctrl.setAggOptions();
  96. // const [templateVariableGroup, aggOptionsGroup] = ctrl.aggOptions;
  97. // expect(ctrl.aggOptions.length).toBe(2);
  98. // expect(templateVariableGroup.options.length).toBe(1);
  99. // expect(aggOptionsGroup.options.length).toBe(10);
  100. // expect(aggOptionsGroup.options.map(o => o.value)).toEqual(
  101. // expect['not'].arrayContaining(['REDUCE_COUNT_TRUE', 'REDUCE_COUNT_FALSE', 'REDUCE_NONE'])
  102. // );
  103. // });
  104. // it('should select some other reducer than REDUCE_NONE', () => {
  105. // ctrl.setAggOptions();
  106. // expect(ctrl.target.crossSeriesReducer).not.toBe('');
  107. // expect(ctrl.target.crossSeriesReducer).not.toBe('REDUCE_NONE');
  108. // });
  109. // });
  110. // });
  111. // });
  112. // });