From: Lucas Di Pentima Date: Mon, 22 Feb 2021 19:59:40 +0000 (-0300) Subject: 17319: Moved mocks' initializations into beforeEach(). X-Git-Tag: 2.1.2.1~13^2~2 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/6a66e260c343d4943a68e5ca5ce205e83ba039c6 17319: Moved mocks' initializations into beforeEach(). Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- diff --git a/src/services/common-service/common-service.test.ts b/src/services/common-service/common-service.test.ts index db36570a..67547105 100644 --- a/src/services/common-service/common-service.test.ts +++ b/src/services/common-service/common-service.test.ts @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: AGPL-3.0 -import axios from "axios"; +import axios, { AxiosInstance } from "axios"; import { ApiActions } from "~/services/api/api-actions"; import { CommonService } from "./common-service"; @@ -12,9 +12,13 @@ const actions: ApiActions = { }; describe("CommonService", () => { - const axiosInstance = axios.create(); - // const axiosMock = new MockAdapter(axiosInstance); - const commonService = new CommonService(axiosInstance, "resource", actions); + let axiosInstance: AxiosInstance; + let commonService: CommonService; + + beforeEach(() => { + commonService = new CommonService(axiosInstance, "resource", actions); + axiosInstance = axios.create(); + }); it("throws an exception when passing uuid as empty string to get()", () => { expect(() => commonService.get("")).toThrowError("UUID cannot be empty string");