[ARVADOS-WORKBENCH2] created: 1.4.1-410-gb71d59f7
Git user
git at public.arvados.org
Wed Aug 26 21:11:14 UTC 2020
at b71d59f7e1876c9eb20c2aa7c749c0acc8568b6f (commit)
commit b71d59f7e1876c9eb20c2aa7c749c0acc8568b6f
Author: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
Date: Wed Aug 26 23:08:37 2020 +0200
16743: fix for non existing parent project
Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
diff --git a/src/views-components/side-panel-button/side-panel-button.test.tsx b/src/views-components/side-panel-button/side-panel-button.test.tsx
new file mode 100644
index 00000000..056b2e64
--- /dev/null
+++ b/src/views-components/side-panel-button/side-panel-button.test.tsx
@@ -0,0 +1,63 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { isProjectTrashed } from './side-panel-button';
+
+describe('<SidePanelButton />', () => {
+ describe('isProjectTrashed', () => {
+ it('should return false if parent project is undefined', () => {
+ // given
+ const proj = {};
+ const resources = {};
+
+ // when
+ const result = isProjectTrashed(proj, resources);
+
+ // then
+ expect(result).toBeFalsy();
+ });
+
+ it('should return false for owner', () => {
+ // given
+ const proj = {
+ ownerUuid: 'ce8i5-tpzed-000000000000000',
+ };
+ const resources = {};
+
+ // when
+ const result = isProjectTrashed(proj, resources);
+
+ // then
+ expect(result).toBeFalsy();
+ });
+
+ it('should return true for trashed', () => {
+ // given
+ const proj = {
+ isTrashed: true,
+ };
+ const resources = {};
+
+ // when
+ const result = isProjectTrashed(proj, resources);
+
+ // then
+ expect(result).toBeTruthy();
+ });
+
+ it.only('should return false for undefined parent projects', () => {
+ // given
+ const proj = {
+ ownerUuid: 'ce8i5-j7d0g-000000000000000',
+ };
+ const resources = {};
+
+ // when
+ const result = isProjectTrashed(proj, resources);
+
+ // then
+ expect(result).toBeFalsy();
+ });
+ });
+});
\ No newline at end of file
diff --git a/src/views-components/side-panel-button/side-panel-button.tsx b/src/views-components/side-panel-button/side-panel-button.tsx
index 07784c5e..58cceafb 100644
--- a/src/views-components/side-panel-button/side-panel-button.tsx
+++ b/src/views-components/side-panel-button/side-panel-button.tsx
@@ -54,10 +54,12 @@ const transformOrigin: PopoverOrigin = {
horizontal: 0
};
-const isProjectTrashed = (proj: GroupResource, resources: ResourcesState): boolean => {
+export const isProjectTrashed = (proj: GroupResource, resources: ResourcesState): boolean => {
+ if (proj === undefined) { return false; }
if (proj.isTrashed) { return true; }
if (extractUuidKind(proj.ownerUuid) === ResourceKind.USER) { return false; }
const parentProj = getResource<GroupResource>(proj.ownerUuid)(resources);
+ console.log(1);
return isProjectTrashed(parentProj!, resources);
};
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list