Skip to content

Commit

Permalink
added quick select utils tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ashikmeerankutty committed Mar 21, 2020
1 parent 0e279fd commit 0e22ab2
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { parseTimeParts } from './quick_select_utils';

describe('parseTimeParts', () => {
it('should parse now', () => {
const out = parseTimeParts('now');
expect(out).toEqual({
timeValueDefault: 15,
timeUnitsDefault: 'm',
timeTenseDefault: 'last',
});
});

it('should parse now-2h', () => {
const out = parseTimeParts('now-2h');
expect(out).toEqual({
timeValueDefault: 2,
timeUnitsDefault: 'h',
timeTenseDefault: 'last',
});
});

it('should parse now+2h', () => {
const out = parseTimeParts('now+2h');
expect(out).toEqual({
timeValueDefault: 2,
timeUnitsDefault: 'h',
timeTenseDefault: 'next',
});
});
});

0 comments on commit 0e22ab2

Please sign in to comment.