18874: Add 'services/workbench2/' from commit 'f6f88d9ca9cdeeeebfadcfe999789bfb9f69e5c6'
[arvados.git] / services / workbench2 / src / models / test-utils.ts
diff --git a/services/workbench2/src/models/test-utils.ts b/services/workbench2/src/models/test-utils.ts
new file mode 100644 (file)
index 0000000..1e1041a
--- /dev/null
@@ -0,0 +1,45 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { GroupClass, GroupResource } from "./group";
+import { Resource, ResourceKind } from "./resource";
+import { ProjectResource } from "./project";
+
+export const mockGroupResource = (data: Partial<GroupResource> = {}): GroupResource => ({
+    createdAt: "",
+    deleteAt: "",
+    description: "",
+    etag: "",
+    groupClass: null,
+    href: "",
+    isTrashed: false,
+    kind: ResourceKind.GROUP,
+    modifiedAt: "",
+    modifiedByClientUuid: "",
+    modifiedByUserUuid: "",
+    name: "",
+    ownerUuid: "",
+    properties: "",
+    trashAt: "",
+    uuid: "",
+    writableBy: [],
+    ensure_unique_name: true,
+    ...data
+});
+
+export const mockProjectResource = (data: Partial<ProjectResource> = {}): ProjectResource =>
+    mockGroupResource({ ...data, groupClass: GroupClass.PROJECT }) as ProjectResource;
+
+export const mockCommonResource = (data: Partial<Resource>): Resource => ({
+    createdAt: "",
+    etag: "",
+    href: "",
+    kind: ResourceKind.NONE,
+    modifiedAt: "",
+    modifiedByClientUuid: "",
+    modifiedByUserUuid: "",
+    ownerUuid: "",
+    uuid: "",
+    ...data
+});