Skip to content

Commit

Permalink
test: Add tests for 'version' (#156)
Browse files Browse the repository at this point in the history
* add tests for 'version'

* Update src/utils/__tests__/version.test.ts

Co-authored-by: Anton Ovchinnikov <anton@tonyo.info>
  • Loading branch information
kination and tonyo committed Jan 4, 2021
1 parent c82ef5a commit 61ddc48
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/utils/__tests__/version.test.ts
Expand Up @@ -22,6 +22,10 @@ describe('getVersion', () => {
test('extracts a SemVer version from text', () => {
expect(getVersion('1.0.0 (foobar)')).toBe('1.0.0');
});

test('extracts a SemVer, but ignores subpatch level', () => {
expect(getVersion('1.0.0.1')).toBe('1.0.0');
});
});

describe('isValidVersion', () => {
Expand Down Expand Up @@ -108,6 +112,10 @@ describe('parseVersion', () => {
test('does not parse an invalid version', () => {
expect(parseVersion('v1.2')).toBeNull();
});

test('cannot parse empty value', () => {
expect(parseVersion('')).toBeNull();
});
});

describe('isPreviewRelease', () => {
Expand Down

0 comments on commit 61ddc48

Please sign in to comment.