mirror of
https://github.com/actions/setup-go.git
synced 2025-04-23 17:40:50 +00:00
added test for .x syntax
This commit is contained in:
parent
3f12dc48a0
commit
aa2b146685
2 changed files with 2500 additions and 0 deletions
2482
__tests__/data/golang-tags.json
Normal file
2482
__tests__/data/golang-tags.json
Normal file
File diff suppressed because it is too large
Load diff
|
@ -2,9 +2,11 @@ import io = require('@actions/io');
|
||||||
import fs = require('fs');
|
import fs = require('fs');
|
||||||
import os = require('os');
|
import os = require('os');
|
||||||
import path = require('path');
|
import path = require('path');
|
||||||
|
import nock = require('nock');
|
||||||
|
|
||||||
const toolDir = path.join(__dirname, 'runner', 'tools');
|
const toolDir = path.join(__dirname, 'runner', 'tools');
|
||||||
const tempDir = path.join(__dirname, 'runner', 'temp');
|
const tempDir = path.join(__dirname, 'runner', 'temp');
|
||||||
|
const dataDir = path.join(__dirname, 'data');
|
||||||
|
|
||||||
process.env['RUNNER_TOOL_CACHE'] = toolDir;
|
process.env['RUNNER_TOOL_CACHE'] = toolDir;
|
||||||
process.env['RUNNER_TEMP'] = tempDir;
|
process.env['RUNNER_TEMP'] = tempDir;
|
||||||
|
@ -39,6 +41,22 @@ describe('installer tests', () => {
|
||||||
}
|
}
|
||||||
}, 100000);
|
}, 100000);
|
||||||
|
|
||||||
|
it('Acquires latest release version of go if using .x syntax and no matching version is installed', async () => {
|
||||||
|
nock('https://api.github.com')
|
||||||
|
.get('/repos/golang/go/git/refs/tags')
|
||||||
|
.replyWithFile(200, path.join(dataDir, 'golang-tags.json'));
|
||||||
|
|
||||||
|
await installer.getGo('1.10.x');
|
||||||
|
const goDir = path.join(toolDir, 'go', '1.10.8', os.arch());
|
||||||
|
|
||||||
|
expect(fs.existsSync(`${goDir}.complete`)).toBe(true);
|
||||||
|
if (IS_WINDOWS) {
|
||||||
|
expect(fs.existsSync(path.join(goDir, 'bin', 'go.exe'))).toBe(true);
|
||||||
|
} else {
|
||||||
|
expect(fs.existsSync(path.join(goDir, 'bin', 'go'))).toBe(true);
|
||||||
|
}
|
||||||
|
}, 100000);
|
||||||
|
|
||||||
it('Throws if no location contains correct go version', async () => {
|
it('Throws if no location contains correct go version', async () => {
|
||||||
let thrown = false;
|
let thrown = false;
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Reference in a new issue