Skip to content

Commit

Permalink
Fixed corresponding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelverschoof committed Apr 7, 2020
1 parent f6c3493 commit 08bbb38
Showing 1 changed file with 5 additions and 24 deletions.
29 changes: 5 additions & 24 deletions test/units/formats.test.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,21 @@
import PrimeError from '../../src/error/prime-error';
import { find, options, timespan } from '../../src/lib/units/formats';

describe('Find', () => {

test('Year', () => {
let result = find('year');
expect(result).toEqual({ year: 'numeric' });

result = find('year-long');
expect(result).toEqual({ year: 'numeric' });

result = find('year-short');
expect(result).toEqual({ year: '2-digit' });
});

test('Non-existent values', () => {
expect(() => { find('non-existent value') }).toThrowError(PrimeError);
});

});
import { options, type } from '../../src/lib/units/formats';

describe('Timespan', () => {

test('Year', () => {
let result = timespan('year');
let result = type('year');
expect(result).toEqual('year');

result = timespan('year-long');
result = type('year-long');
expect(result).toEqual('year');

result = timespan('year-short');
result = type('year-short');
expect(result).toEqual('year');
});

test('Non-existent values', () => {
expect(() => { timespan('non-existent value') }).toThrowError(PrimeError);
expect(() => { type('non-existent value') }).toThrowError(PrimeError);
});

});
Expand Down

0 comments on commit 08bbb38

Please sign in to comment.