2021-09-01 12:29:50 +10:00
|
|
|
import {install, runCommand} from '../src/install'
|
|
|
|
|
import * as core from '@actions/core'
|
|
|
|
|
|
2021-07-15 07:24:13 +08:00
|
|
|
import {expect, test} from '@jest/globals'
|
2020-08-27 20:39:35 +08:00
|
|
|
|
|
|
|
|
test('runCommand', async () => {
|
|
|
|
|
const result = await runCommand('echo foo bar')
|
|
|
|
|
expect(result).toBe('foo bar')
|
|
|
|
|
})
|
2021-09-01 12:29:50 +10:00
|
|
|
|
|
|
|
|
async function testVersion(version: string) {
|
|
|
|
|
const commandPath = await install(version)
|
|
|
|
|
core.addPath(commandPath)
|
|
|
|
|
const result = await runCommand('docker-compose version')
|
|
|
|
|
expect(result).toContain(version)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
test('Install the right version', async () => {
|
|
|
|
|
await testVersion('1.29.1')
|
|
|
|
|
await testVersion('1.29.2')
|
2022-04-18 06:40:59 +03:00
|
|
|
await testVersion('2.2.3')
|
2022-04-19 15:59:39 +08:00
|
|
|
await testVersion('v2.2.3')
|
2021-09-01 12:29:50 +10:00
|
|
|
})
|