Update tests

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2020-08-23 03:36:35 +02:00
parent 3e57a3300a
commit e8186e990f
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7

@ -1,6 +1,7 @@
import fs from 'fs'; import fs from 'fs';
import * as semver from 'semver'; import * as semver from 'semver';
import * as buildx from '../src/buildx'; import * as buildx from '../src/buildx';
import * as exec from '@actions/exec';
const digest = 'sha256:bfb45ab72e46908183546477a08f8867fc40cebadd00af54b071b097aed127a9'; const digest = 'sha256:bfb45ab72e46908183546477a08f8867fc40cebadd00af54b071b097aed127a9';
@ -17,6 +18,7 @@ describe('getImageID', () => {
describe('getVersion', () => { describe('getVersion', () => {
it('valid', async () => { it('valid', async () => {
await exec.exec('docker', ['buildx', 'version']);
const version = await buildx.getVersion(); const version = await buildx.getVersion();
console.log(`version: ${version}`); console.log(`version: ${version}`);
expect(semver.valid(version)).not.toBeNull(); expect(semver.valid(version)).not.toBeNull();
@ -25,6 +27,7 @@ describe('getVersion', () => {
describe('parseVersion', () => { describe('parseVersion', () => {
test.each([ test.each([
['github.com/docker/buildx v0.2.2 ab5fe3dec5785b8d0a7d2cf2499c38e504d4c609', '0.2.2'],
['github.com/docker/buildx v0.4.1 bda4882a65349ca359216b135896bddc1d92461c', '0.4.1'], ['github.com/docker/buildx v0.4.1 bda4882a65349ca359216b135896bddc1d92461c', '0.4.1'],
['github.com/docker/buildx v0.4.2 fb7b670b764764dc4716df3eba07ffdae4cc47b2', '0.4.2'] ['github.com/docker/buildx v0.4.2 fb7b670b764764dc4716df3eba07ffdae4cc47b2', '0.4.2']
])('given %p', async (stdout, expected) => { ])('given %p', async (stdout, expected) => {