functions.test.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { getAlignmentOptionsByMetric } from './functions';
  2. import { ValueTypes, MetricKind } from './constants';
  3. describe('functions', () => {
  4. let result: any;
  5. describe('getAlignmentOptionsByMetric', () => {
  6. describe('when double and gauge is passed', () => {
  7. beforeEach(() => {
  8. result = getAlignmentOptionsByMetric(ValueTypes.DOUBLE, MetricKind.GAUGE);
  9. });
  10. it('should return all alignment options except two', () => {
  11. expect(result.length).toBe(9);
  12. expect(result.map((o: any) => o.value)).toEqual(
  13. expect.not.arrayContaining(['REDUCE_COUNT_TRUE', 'REDUCE_COUNT_FALSE'])
  14. );
  15. });
  16. });
  17. describe('when double and delta is passed', () => {
  18. beforeEach(() => {
  19. result = getAlignmentOptionsByMetric(ValueTypes.DOUBLE, MetricKind.DELTA);
  20. });
  21. it('should return all alignment options except four', () => {
  22. expect(result.length).toBe(9);
  23. expect(result.map((o: any) => o.value)).toEqual(
  24. expect.not.arrayContaining([
  25. 'ALIGN_COUNT_TRUE',
  26. 'ALIGN_COUNT_FALSE',
  27. 'ALIGN_FRACTION_TRUE',
  28. 'ALIGN_INTERPOLATE',
  29. ])
  30. );
  31. });
  32. });
  33. });
  34. });