fix broken tests

This commit is contained in:
Erik Sundell
2019-01-02 13:03:21 +01:00
parent 4dbd113e20
commit b7503407e6
@@ -17,27 +17,64 @@ describe('StackdriverAggregationCtrl', () => {
}, },
{ {
replace: s => s, replace: s => s,
variables: [{ name: 'someVariable1' }, { name: 'someVariable2' }],
} }
); );
}); });
it('should populate all aggregate options except two', () => { it('should populate all aggregate options except two', () => {
ctrl.setAggOptions(); ctrl.setAggOptions();
expect(ctrl.aggOptions.length).toBe(11); const [aggOptionsGroup] = ctrl.aggOptions;
expect(ctrl.aggOptions.map(o => o.value)).toEqual( expect(aggOptionsGroup.options.length).toBe(11);
expect(aggOptionsGroup.options.map(o => o.value)).toEqual(
expect['not'].arrayContaining(['REDUCE_COUNT_TRUE', 'REDUCE_COUNT_FALSE']) expect['not'].arrayContaining(['REDUCE_COUNT_TRUE', 'REDUCE_COUNT_FALSE'])
); );
}); });
it('should populate all alignment options except two', () => { it('should populate all alignment options except two', () => {
ctrl.setAlignOptions(); ctrl.setAlignOptions();
expect(ctrl.alignOptions.length).toBe(9); const [aggOptionsGroup] = ctrl.aggOptions;
expect(ctrl.alignOptions.map(o => o.value)).toEqual( expect(aggOptionsGroup.options.length).toBe(11);
expect(aggOptionsGroup.options.map(o => o.value)).toEqual(
expect['not'].arrayContaining(['REDUCE_COUNT_TRUE', 'REDUCE_COUNT_FALSE']) expect['not'].arrayContaining(['REDUCE_COUNT_TRUE', 'REDUCE_COUNT_FALSE'])
); );
}); });
}); });
describe('and result is double and delta and no group by is used', () => {
beforeEach(async () => {
ctrl = new StackdriverAggregationCtrl(
{
$on: () => {},
target: {
valueType: 'DOUBLE',
metricKind: 'DELTA',
aggregation: { crossSeriesReducer: '', groupBys: [] },
},
},
{
replace: s => s,
variables: [{ name: 'someVariable1' }, { name: 'someVariable2' }],
}
);
});
it('should populate all alignment options except four', () => {
ctrl.setAlignOptions();
const [alignOptionsGroup] = ctrl.alignOptions;
expect(alignOptionsGroup.options.length).toBe(9);
expect(alignOptionsGroup.options.map(o => o.value)).toEqual(
expect['not'].arrayContaining([
'ALIGN_NEXT_OLDER',
'ALIGN_INTERPOLATE',
'ALIGN_COUNT_TRUE',
'ALIGN_COUNT_FALSE',
'ALIGN_FRACTION_TRUE',
])
);
});
});
describe('and result is double and gauge and a group by is used', () => { describe('and result is double and gauge and a group by is used', () => {
beforeEach(async () => { beforeEach(async () => {
ctrl = new StackdriverAggregationCtrl( ctrl = new StackdriverAggregationCtrl(
@@ -51,14 +88,16 @@ describe('StackdriverAggregationCtrl', () => {
}, },
{ {
replace: s => s, replace: s => s,
variables: [{ name: 'someVariable1' }],
} }
); );
}); });
it('should populate all aggregate options except three', () => { it('should populate all aggregate options except three', () => {
ctrl.setAggOptions(); ctrl.setAggOptions();
expect(ctrl.aggOptions.length).toBe(10); const [aggOptionsGroup] = ctrl.aggOptions;
expect(ctrl.aggOptions.map(o => o.value)).toEqual( expect(aggOptionsGroup.options.length).toBe(10);
expect(aggOptionsGroup.options.map(o => o.value)).toEqual(
expect['not'].arrayContaining(['REDUCE_COUNT_TRUE', 'REDUCE_COUNT_FALSE', 'REDUCE_NONE']) expect['not'].arrayContaining(['REDUCE_COUNT_TRUE', 'REDUCE_COUNT_FALSE', 'REDUCE_NONE'])
); );
}); });