Merge branch '21900-groups-panel-toolbar'
[arvados.git] / services / workbench2 / src / models / test-utils.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { GroupClass, GroupResource } from "./group";
6 import { Resource, ResourceKind } from "./resource";
7 import { ProjectResource } from "./project";
8
9 export const mockGroupResource = (data: Partial<GroupResource> = {}): GroupResource => ({
10     createdAt: "",
11     deleteAt: "",
12     description: "",
13     etag: "",
14     groupClass: null,
15     href: "",
16     isTrashed: false,
17     kind: ResourceKind.GROUP,
18     modifiedAt: "",
19     modifiedByUserUuid: "",
20     name: "",
21     ownerUuid: "",
22     properties: "",
23     trashAt: "",
24     uuid: "",
25     ensure_unique_name: true,
26     canWrite: false,
27     canManage: false,
28     ...data
29 });
30
31 export const mockProjectResource = (data: Partial<ProjectResource> = {}): ProjectResource =>
32     mockGroupResource({ ...data, groupClass: GroupClass.PROJECT }) as ProjectResource;
33
34 export const mockCommonResource = (data: Partial<Resource>): Resource => ({
35     createdAt: "",
36     etag: "",
37     href: "",
38     kind: ResourceKind.NONE,
39     modifiedAt: "",
40     modifiedByUserUuid: "",
41     ownerUuid: "",
42     uuid: "",
43     ...data
44 });