Test run proper check for accurate installation

This commit is contained in:
Zachary Eisinger 2019-12-19 14:44:08 -08:00
parent e201cec6d1
commit 1bca1dc5d1
3 changed files with 12 additions and 13 deletions

View File

@ -84,6 +84,10 @@ describe('authutil tests', () => {
await io.mkdirP(fakeSourcesDirForTesting);
}, 30000);
afterAll(async () => {
await io.rmRF(fakeSourcesDirForTesting);
}, 30000);
beforeEach(() => {
if (fs.existsSync(nugetConfigFile)) {
fs.unlinkSync(nugetConfigFile);

View File

@ -1,6 +1,5 @@
import io = require('@actions/io');
import fs = require('fs');
import os = require('os');
import path = require('path');
import httpClient = require('typed-rest-client/HttpClient');
@ -31,15 +30,13 @@ describe('installer tests', () => {
it('Acquires version of dotnet if no matching version is installed', async () => {
await getDotnet('3.1.100');
const dotnetDir = path.join(toolDir, 'dncs', '3.1.100', os.arch());
expect(fs.existsSync(`${dotnetDir}.complete`)).toBe(true);
expect(fs.existsSync(path.join(toolDir, 'sdk', '3.1.100'))).toBe(true);
if (IS_WINDOWS) {
expect(fs.existsSync(path.join(dotnetDir, 'dotnet.exe'))).toBe(true);
expect(fs.existsSync(path.join(toolDir, 'dotnet.exe'))).toBe(true);
} else {
expect(fs.existsSync(path.join(dotnetDir, 'dotnet'))).toBe(true);
expect(fs.existsSync(path.join(toolDir, 'dotnet'))).toBe(true);
}
}, 30000);
}, 100000);
it('Throws if no location contains correct dotnet version', async () => {
let thrown = false;

View File

@ -30,8 +30,6 @@ describe('setup-dotnet tests', () => {
}, 30000);
it('Acquires version of dotnet if no matching version is installed', async () => {
const dotnetDir = path.join(toolDir, 'dncs', '3.1.100', os.arch());
const globalJsonPath = path.join(process.cwd(), 'global.json');
const jsonContents = `{${os.EOL}"sdk": {${os.EOL}"version": "3.1.100"${os.EOL}}${os.EOL}}`;
if (!fs.existsSync(globalJsonPath)) {
@ -39,12 +37,12 @@ describe('setup-dotnet tests', () => {
}
await setup.run();
expect(fs.existsSync(`${dotnetDir}.complete`)).toBe(true);
expect(fs.existsSync(path.join(toolDir, 'sdk', '3.1.100'))).toBe(true);
if (IS_WINDOWS) {
expect(fs.existsSync(path.join(dotnetDir, 'dotnet.exe'))).toBe(true);
expect(fs.existsSync(path.join(toolDir, 'dotnet.exe'))).toBe(true);
} else {
expect(fs.existsSync(path.join(dotnetDir, 'dotnet'))).toBe(true);
expect(fs.existsSync(path.join(toolDir, 'dotnet'))).toBe(true);
}
fs.unlinkSync(globalJsonPath);
}, 30000);
}, 100000);
});