db36570a89683a6bf6d56958b25dfe77a3969938
[arvados-workbench2.git] / src / services / common-service / common-service.test.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import axios from "axios";
6 import { ApiActions } from "~/services/api/api-actions";
7 import { CommonService } from "./common-service";
8
9 const actions: ApiActions = {
10     progressFn: (id: string, working: boolean) => {},
11     errorFn: (id: string, message: string) => {}
12 };
13
14 describe("CommonService", () => {
15     const axiosInstance = axios.create();
16     // const axiosMock = new MockAdapter(axiosInstance);
17     const commonService = new CommonService(axiosInstance, "resource", actions);
18
19     it("throws an exception when passing uuid as empty string to get()", () => {
20         expect(() => commonService.get("")).toThrowError("UUID cannot be empty string");
21     });
22
23     it("throws an exception when passing uuid as empty string to update()", () => {
24         expect(() => commonService.update("", {})).toThrowError("UUID cannot be empty string");
25     });
26
27     it("throws an exception when passing uuid as empty string to delete()", () => {
28         expect(() => commonService.delete("")).toThrowError("UUID cannot be empty string");
29     });
30 });