Reset mock after each test

Co-authored-by: Patrik Oldsberg <poldsberg@gmail.com>
Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
Johan Haals
2021-03-01 14:18:02 +01:00
parent d0af57563d
commit 8c1adc2404
@@ -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);