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";
8 import { ProjectResource } from "../../models/project";
10 describe("CommonResourceService", () => {
11 const axiosInstance = axios.create();
13 it(`#create has groupClass set to "project"`, async () => {
14 axiosInstance.post = jest.fn(() => Promise.resolve({ data: {} }));
15 const projectService = new ProjectService(axiosInstance);
16 const resource = await projectService.create({ name: "nameValue" });
17 expect(axiosInstance.post).toHaveBeenCalledWith("/groups/", {
19 group_class: "project"
24 it("#list has groupClass filter set by default", async () => {
25 axiosInstance.get = jest.fn(() => Promise.resolve({ data: {} }));
26 const projectService = new ProjectService(axiosInstance);
27 const resource = await projectService.list();
28 expect(axiosInstance.get).toHaveBeenCalledWith("/groups/", {
30 filters: FilterBuilder
31 .create<ProjectResource>()
32 .addEqual("groupClass", "project")