18866: Adds test exposing the problem.
[arvados-workbench2.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 { 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     modifiedByClientUuid: "",
20     modifiedByUserUuid: "",
21     name: "",
22     ownerUuid: "",
23     properties: "",
24     trashAt: "",
25     uuid: "",
26     writableBy: [],
27     ensure_unique_name: true,
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     modifiedByClientUuid: "",
41     modifiedByUserUuid: "",
42     ownerUuid: "",
43     uuid: "",
44     ...data
45 });