docker: check command using actions/io module

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2023-02-21 08:40:27 +01:00
parent 3d9ec9f02d
commit 99487d6986
4 changed files with 12 additions and 19 deletions

View File

@@ -16,6 +16,7 @@
import {afterEach, beforeEach, describe, expect, it, jest} from '@jest/globals';
import path from 'path';
import * as io from '@actions/io';
import osm = require('os');
import {Docker} from '../src/docker';
@@ -49,13 +50,10 @@ describe('configDir', () => {
describe('isAvailable', () => {
it('cli', async () => {
const execSpy = jest.spyOn(Exec, 'getExecOutput');
const ioWhichSpy = jest.spyOn(io, 'which');
await Docker.isAvailable();
// eslint-disable-next-line jest/no-standalone-expect
expect(execSpy).toHaveBeenCalledWith(`docker`, [], {
silent: true,
ignoreReturnCode: true
});
expect(ioWhichSpy).toHaveBeenCalledTimes(1);
expect(ioWhichSpy).toHaveBeenCalledWith('docker', true);
});
});