1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import axios from "axios";
6 import { ProjectService } from "./project-service";
7 import { FilterBuilder } from "~/common/api/filter-builder";
9 describe("CommonResourceService", () => {
10 const axiosInstance = axios.create();
12 it(`#create has groupClass set to "project"`, async () => {
13 axiosInstance.post = jest.fn(() => Promise.resolve({ data: {} }));
14 const projectService = new ProjectService(axiosInstance);
15 const resource = await projectService.create({ name: "nameValue" });
16 expect(axiosInstance.post).toHaveBeenCalledWith("/groups/", {
18 group_class: "project"
22 it("#list has groupClass filter set by default", async () => {
23 axiosInstance.get = jest.fn(() => Promise.resolve({ data: {} }));
24 const projectService = new ProjectService(axiosInstance);
25 const resource = await projectService.list();
26 expect(axiosInstance.get).toHaveBeenCalledWith("/groups/", {
28 filters: FilterBuilder
30 .addEqual("groupClass", "project")