generated from actions/javascript-action
-
Notifications
You must be signed in to change notification settings - Fork 4
/
installer.test.js
31 lines (23 loc) · 966 Bytes
/
installer.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* eslint-env jest */
jest.mock('@actions/core')
const io = require('@actions/io')
const process = require('process')
const path = require('path')
const existsSync = require('fs').existsSync
process.env.RUNNER_TOOL_CACHE = path.join(__dirname, '../tmp/runner_tools')
process.env.RUNNER_TEMP = path.join(__dirname, '../tmp/runner_tmpdir')
const installNodenv = require('./installer').installNodenv
describe('installer tests', () => {
beforeAll(async () => {
await io.rmRF(process.env.RUNNER_TOOL_CACHE)
await io.rmRF(process.env.RUNNER_TEMP)
}, 100000)
it('Acquires requested version of nodenv', async () => {
const nodenvDir = await installNodenv('1.3.1')
expect(existsSync(`${nodenvDir}.complete`)).toBe(true)
expect(existsSync(path.join(nodenvDir, 'bin/nodenv'))).toBe(true)
}, 100000)
it('Throws on unreleased version of nodenv', async () => {
return expect(installNodenv('0.0.0')).rejects.toThrow('404')
}, 100000)
})