Skip to content

Commit

Permalink
add unit tests for getSmallerInterval
Browse files Browse the repository at this point in the history
  • Loading branch information
MGJamJam committed Jul 10, 2024
1 parent 5687221 commit d2e46b1
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/utils/intervalUtils.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
import { calculateQueryInterval } from './intervalUtils';
import { calculateQueryInterval, getSmallerInterval } from './intervalUtils';

describe('getSmallerInterval', () => {
it('should return smaller interval for MINUTE and HOUR interval', () => {
//arrange && act
const result = getSmallerInterval('HOUR', 'MINUTE');

//assert
expect(result).toEqual('MINUTE');
});

it('should return smaller interval for HOUR and DAY interval', () => {
//arrange && act
const result = getSmallerInterval('DAY', 'HOUR');

//assert
expect(result).toEqual('HOUR');
});

it('should return smaller interval for DAY and MONTH interval', () => {
//arrange && act
const result = getSmallerInterval('DAY', 'MONTH');

//assert
expect(result).toEqual('DAY');
});
});

describe('calculateQueryInterval', () => {
it('should return correct given interval if interval is not AUTO', () => {
Expand Down

0 comments on commit d2e46b1

Please sign in to comment.