builder: exists method

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2023-03-03 14:48:12 +01:00
parent 2090433c0d
commit 32af66cb28
3 changed files with 40 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ import * as fs from 'fs';
import * as path from 'path';
import {Builder} from '../../src/buildx/builder';
import {Exec} from '../../src/exec';
import {BuilderInfo} from '../../src/types/builder';
@@ -47,6 +48,19 @@ jest.spyOn(Builder.prototype, 'inspect').mockImplementation(async (): Promise<Bu
};
});
describe('exists', () => {
it('valid', async () => {
const execSpy = jest.spyOn(Exec, 'getExecOutput');
const builder = new Builder();
await builder.exists('foo');
// eslint-disable-next-line jest/no-standalone-expect
expect(execSpy).toHaveBeenCalledWith(`docker`, ['buildx', 'inspect', 'foo'], {
silent: true,
ignoreReturnCode: true
});
});
});
describe('inspect', () => {
it('valid', async () => {
const builder = new Builder();