From 8c1adc2404307d0a7bc4363c74e949f3019c1bd7 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 1 Mar 2021 14:18:02 +0100 Subject: [PATCH] Reset mock after each test Co-authored-by: Patrik Oldsberg Signed-off-by: Johan Haals --- .../scaffolder/actions/builtin/fetch/cookiecutter.test.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/cookiecutter.test.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/cookiecutter.test.ts index 923e22d0a5..7d26bcb20a 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/cookiecutter.test.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/cookiecutter.test.ts @@ -57,8 +57,6 @@ describe('fetch:cookiecutter', () => { createTemporaryDirectory: jest.fn().mockResolvedValue(mockTmpDir), }; - mock({ [`${mockContext.workspacePath}/result`]: {} }); - const mockReader: UrlReader = { read: jest.fn(), readTree: jest.fn(), @@ -75,9 +73,14 @@ describe('fetch:cookiecutter', () => { templaters.register('cookiecutter', cookiecutterTemplater); beforeEach(() => { + mock({ [`${mockContext.workspacePath}/result`]: {} }); jest.restoreAllMocks(); }); + afterEach(() => { + mock.restore(); + }); + it('should call fetchContents with the correct values', async () => { await action.handler(mockContext);