mirror of
				https://github.com/actions/setup-node.git
				synced 2025-11-04 13:29:12 +08:00 
			
		
		
		
	Add tests for parseNodeVersionFile
This commit is contained in:
		@@ -7,6 +7,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';
 | 
			
		||||
 | 
			
		||||
@@ -941,3 +942,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);
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user