Skip to content

Commit

Permalink
Add tests for parseNodeVersionFile
Browse files Browse the repository at this point in the history
  • Loading branch information
ganta committed Dec 2, 2021
1 parent 04c56d2 commit 6bf4384
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions __tests__/installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import fs from 'fs';
import cp from 'child_process';
import osm = require('os');
import path from 'path';
import each from 'jest-each';
import * as main from '../src/main';
import * as auth from '../src/authutil';

Expand Down Expand Up @@ -862,3 +863,21 @@ describe('setup-node', () => {
});
});
});

describe('helper methods', () => {
describe('parseNodeVersionFile', () => {
each`
contents | expected
${'12'} | ${'12'}
${'12.3'} | ${'12.3'}
${'12.3.4'} | ${'12.3.4'}
${'v12.3.4'} | ${'12.3.4'}
${'lts/erbium'} | ${'lts/erbium'}
${'lts/*'} | ${'lts/*'}
${''} | ${''}
${'unknown format'} | ${'unknown format'}
`.it('parses "$contents"', ({contents, expected}) => {
expect(im.parseNodeVersionFile(contents)).toBe(expected);
});
});
});

0 comments on commit 6bf4384

Please sign in to comment.