Merge branch 'main' into 18692-frozen-projects-workbench-support
[arvados.git] / src / views-components / side-panel-button / side-panel-button.test.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { isProjectTrashed } from './side-panel-button';
6
7 describe('<SidePanelButton />', () => {
8     describe('isProjectTrashed', () => {
9         it('should return false if project is undefined', () => {
10             // given
11             const proj = undefined;
12             const resources = {};
13
14             // when
15             const result = isProjectTrashed(proj, resources);
16
17             // then
18             expect(result).toBeFalsy();
19         });
20
21         it('should return false if parent project is undefined', () => {
22             // given
23             const proj = {};
24             const resources = {};
25
26             // when
27             const result = isProjectTrashed(proj, resources);
28
29             // then
30             expect(result).toBeFalsy();
31         });
32
33         it('should return false for owner', () => {
34             // given
35             const proj = {
36                 ownerUuid: 'ce8i5-tpzed-000000000000000',
37             };
38             const resources = {};
39
40             // when
41             const result = isProjectTrashed(proj, resources);
42
43             // then
44             expect(result).toBeFalsy();
45         });
46
47         it('should return true for trashed', () => {
48             // given
49             const proj = {
50                 isTrashed: true,
51             };
52             const resources = {};
53
54             // when
55             const result = isProjectTrashed(proj, resources);
56
57             // then
58             expect(result).toBeTruthy();
59         });
60
61         it('should return false for undefined parent projects', () => {
62             // given
63             const proj = {
64                 ownerUuid: 'ce8i5-j7d0g-000000000000000',
65             };
66             const resources = {};
67
68             // when
69             const result = isProjectTrashed(proj, resources);
70
71             // then
72             expect(result).toBeFalsy();
73         });
74     });
75 });