From 0f0b1bb9ba51c4337009c3fafd93f6a9af885d2d Mon Sep 17 00:00:00 2001 From: Sascha Mann Date: Fri, 4 Oct 2019 00:36:39 +0200 Subject: [PATCH] Add some unit tests for getJuliaVersions --- __tests__/main.test.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index 9228bf9..93aa1a7 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -1,3 +1,17 @@ -describe('TODO - Add a test suite', () => { - it('TODO - Add a test', async () => {}) +import * as installer from '../src/installer' + +describe('installer tests', () => { + describe('version matching', () => { + describe('specific versions', () => { + it('Doesn\'t change the version when given a valid semver version', async () => { + expect(await installer.getJuliaVersion([], '1.0.5')).toEqual('1.0.5') + expect(await installer.getJuliaVersion(['v1.0.5', 'v1.0.6'], '1.0.5')).toEqual('1.0.5') + expect(await installer.getJuliaVersion(['v1.0.4', 'v1.0.5'], '1.0.5')).toEqual('1.0.5') + expect(await installer.getJuliaVersion(['v1.0.4'], '1.0.5')).toEqual('1.0.5') + expect(await installer.getJuliaVersion([], '1.3.0-alpha')).toEqual('1.3.0-alpha') + expect(await installer.getJuliaVersion(['v1.2.0', 'v1.3.0-alpha', 'v1.3.0-rc1', 'v1.3.0'], '1.3.0-alpha')).toEqual('1.3.0-alpha') + expect(await installer.getJuliaVersion([], '1.3.0-rc2')).toEqual('1.3.0-rc2') + }) + }) + }) })