mirror of
https://github.com/docker/actions-toolkit.git
synced 2024-11-23 03:16:09 +08:00
test: clear mocks
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
251b9d49f3
commit
66653922b3
@ -1,8 +1,12 @@
|
||||
import {describe, expect, it, test} from '@jest/globals';
|
||||
import {jest, describe, expect, it, test, beforeEach} from '@jest/globals';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import {Builder} from '../src/builder';
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
describe('inspect', () => {
|
||||
it('valid', async () => {
|
||||
const builder = new Builder();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {afterEach, describe, expect, it, jest, test} from '@jest/globals';
|
||||
import {afterEach, beforeEach, describe, expect, it, jest, test} from '@jest/globals';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as semver from 'semver';
|
||||
@ -21,6 +21,10 @@ jest.spyOn(BuildKit.prototype as any, 'tmpName').mockImplementation((): string =
|
||||
return tmpName;
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
rimraf.sync(tmpDir);
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {afterEach, describe, expect, it, jest, test} from '@jest/globals';
|
||||
import {afterEach, beforeEach, describe, expect, it, jest, test} from '@jest/globals';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as semver from 'semver';
|
||||
@ -21,6 +21,10 @@ jest.spyOn(Buildx.prototype as any, 'tmpDir').mockImplementation((): string => {
|
||||
return tmpDir;
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
rimraf.sync(tmpDir);
|
||||
});
|
||||
|
@ -1,8 +1,12 @@
|
||||
import {describe, expect, it, jest} from '@jest/globals';
|
||||
import {beforeEach, describe, expect, it, jest} from '@jest/globals';
|
||||
import * as exec from '@actions/exec';
|
||||
|
||||
import {Docker} from '../src/docker';
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
describe('isAvailable', () => {
|
||||
it('cli', () => {
|
||||
const execSpy = jest.spyOn(exec, 'getExecOutput');
|
||||
|
@ -1,6 +1,10 @@
|
||||
import {describe, expect, it} from '@jest/globals';
|
||||
import {beforeEach, describe, expect, it, jest} from '@jest/globals';
|
||||
import * as git from '../src/git';
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
describe('git', () => {
|
||||
it('returns git remote ref', async () => {
|
||||
const ref: string = await git.getRemoteSha('https://github.com/docker/buildx.git', 'refs/pull/648/head');
|
||||
|
@ -1,8 +1,12 @@
|
||||
import {describe, expect, jest, it} from '@jest/globals';
|
||||
import {describe, expect, jest, it, beforeEach} from '@jest/globals';
|
||||
import {Context} from '@actions/github/lib/context';
|
||||
|
||||
import {GitHub, Payload, ReposGetResponseData} from '../src/github';
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
jest.spyOn(GitHub.prototype, 'context').mockImplementation((): Context => {
|
||||
return new Context();
|
||||
});
|
||||
|
@ -1,9 +1,13 @@
|
||||
import {describe, expect, it, test} from '@jest/globals';
|
||||
import {beforeEach, describe, expect, it, jest, test} from '@jest/globals';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
import {Util} from '../src/util';
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
describe('getInputList', () => {
|
||||
it('single line correctly', async () => {
|
||||
await setInput('foo', 'bar');
|
||||
|
Loading…
Reference in New Issue
Block a user