Skip to content

Commit

Permalink
✅ Fix tests for extractVersionTuple
Browse files Browse the repository at this point in the history
  • Loading branch information
priestine committed Jul 3, 2020
1 parent 5c7ce0f commit 1e8defa
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions test/utils/helpers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,26 @@ test('trimCmdNewLine should remove ending \\n', (t) => {
test('extractVersionTuple should take version tuple from a version string', (t) => {
const tuple: any = extractVersionTuple('1.0.0')
t.is(tuple[0], '1.0.0')
t.is(tuple[1], '1')
t.is(tuple[2], '0')
t.is(tuple[1], undefined)
t.is(tuple[2], '1')
t.is(tuple[3], '0')
t.is(tuple[4], '0')
})

test('extractVersionTuple should handle prefixes', (t) => {
const tuple: any = extractVersionTuple('2020.1.0.0')
t.is(tuple[0], '2020.1.0.0')
t.is(tuple[1], '2020')
t.is(tuple[2], '1')
t.is(tuple[3], '0')
t.is(tuple[4], '0')
})

test('extractVersionTuple should ignore pre-releases and build metadata', (t) => {
const tuple: any = extractVersionTuple('1.0.0-alpha.1+20200101')
t.is(tuple[0], '1.0.0')
t.is(tuple[1], undefined)
t.is(tuple[2], '1')
t.is(tuple[3], '0')
t.is(tuple[4], '0')
})

0 comments on commit 1e8defa

Please sign in to comment.