3
0
Fork 0
mirror of https://gitea.com/docker/setup-qemu-action.git synced 2024-11-22 09:29:32 +01:00
docker-setup-qemu/__tests__/qemu.test.ts
CrazyMax 3bf7a4ebec
display QEMU version installed on the runner
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-01-05 12:14:37 +01:00

24 lines
712 B
TypeScript

import {describe, expect, jest, it} from '@jest/globals';
import * as io from '@actions/io';
import {Exec} from '@docker/actions-toolkit/lib/exec';
import * as qemu from '../src/qemu';
describe('isInstalled', () => {
it('bin', async () => {
const ioWhichSpy = jest.spyOn(io, 'which');
await qemu.isInstalled();
expect(ioWhichSpy).toHaveBeenCalledTimes(1);
expect(ioWhichSpy).toHaveBeenCalledWith(qemu.bin(), true);
});
});
describe('printVersion', () => {
it('call qemu --version', async () => {
const execSpy = jest.spyOn(Exec, 'exec');
await qemu.printVersion().catch(() => {
// noop
});
expect(execSpy).toHaveBeenCalledWith(qemu.bin(), ['--version']);
});
});