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 commonService: CommonService<any>;
18 commonService = new CommonService<any>({} as AxiosInstance, "resource", actions);
21 it("throws an exception when passing uuid as empty string to get()", () => {
22 expect(() => commonService.get("")).toThrowError("UUID cannot be empty string");
25 it("throws an exception when passing uuid as empty string to update()", () => {
26 expect(() => commonService.update("", {})).toThrowError("UUID cannot be empty string");
29 it("throws an exception when passing uuid as empty string to delete()", () => {
30 expect(() => commonService.delete("")).toThrowError("UUID cannot be empty string");