Skip to content

Commit 8249676

Browse files
committed
Add tests for parseNodeVersionFile
1 parent ed1a46e commit 8249676

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

__tests__/installer.test.ts

+19
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import fs from 'fs';
77
import cp from 'child_process';
88
import osm = require('os');
99
import path from 'path';
10+
import each from 'jest-each';
1011
import * as main from '../src/main';
1112
import * as auth from '../src/authutil';
1213

@@ -941,3 +942,21 @@ describe('setup-node', () => {
941942
);
942943
});
943944
});
945+
946+
describe('helper methods', () => {
947+
describe('parseNodeVersionFile', () => {
948+
each`
949+
contents | expected
950+
${'12'} | ${'12'}
951+
${'12.3'} | ${'12.3'}
952+
${'12.3.4'} | ${'12.3.4'}
953+
${'v12.3.4'} | ${'12.3.4'}
954+
${'lts/erbium'} | ${'lts/erbium'}
955+
${'lts/*'} | ${'lts/*'}
956+
${''} | ${''}
957+
${'unknown format'} | ${'unknown format'}
958+
`.it('parses "$contents"', ({contents, expected}) => {
959+
expect(im.parseNodeVersionFile(contents)).toBe(expected);
960+
});
961+
});
962+
});

0 commit comments

Comments
 (0)