1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import axios, { AxiosInstance } from "axios";
6 import { ApiActions } from "~/services/api/api-actions";
7 import { CommonService } from "./common-service";
9 const actions: ApiActions = {
10 progressFn: (id: string, working: boolean) => {},
11 errorFn: (id: string, message: string) => {}
14 describe("CommonService", () => {
15 let axiosInstance: AxiosInstance;
16 let commonService: CommonService<any>;
19 commonService = new CommonService<any>(axiosInstance, "resource", actions);
20 axiosInstance = axios.create();
23 it("throws an exception when passing uuid as empty string to get()", () => {
24 expect(() => commonService.get("")).toThrowError("UUID cannot be empty string");
27 it("throws an exception when passing uuid as empty string to update()", () => {
28 expect(() => commonService.update("", {})).toThrowError("UUID cannot be empty string");
31 it("throws an exception when passing uuid as empty string to delete()", () => {
32 expect(() => commonService.delete("")).toThrowError("UUID cannot be empty string");