Merge branch 'master' into 13853-collection-view-info-card
[arvados.git] / 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 { GroupResource, GroupClass } 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     modifiedByClientUuid: "",
20     modifiedByUserUuid: "",
21     name: "",
22     ownerUuid: "",
23     properties: "",
24     trashAt: "",
25     uuid: "",
26     writeableBy: [],
27     ...data
28 });
29
30 export const mockProjectResource = (data: Partial<ProjectResource> = {}): ProjectResource =>
31     mockGroupResource({ ...data, groupClass: GroupClass.PROJECT }) as ProjectResource;
32
33 export const mockCommonResource = (data: Partial<Resource>): Resource => ({
34     createdAt: "",
35     etag: "",
36     href: "",
37     kind: "",
38     modifiedAt: "",
39     modifiedByClientUuid: "",
40     modifiedByUserUuid: "",
41     ownerUuid: "",
42     uuid: "",
43     ...data
44 });