• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CBIIT / bento-icdc-frontend / 26521483403

27 May 2026 03:36PM UTC coverage: 17.458% (-8.3%) from 25.73%
26521483403

Pull #1607

github

web-flow
Merge 2f30510ff into bc935f39c
Pull Request #1607: Feature/ai test studio - ICDC-4165 & ICDC-4171

306 of 2587 branches covered (11.83%)

Branch coverage included in aggregate %.

1 of 4244 new or added lines in 74 files covered. (0.02%)

2 existing lines in 2 files now uncovered.

2197 of 11750 relevant lines covered (18.7%)

0.41 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/components/PaginatedTable/Customize/DataAvailability/TableCell.generated.test.jsx
1
// src/components/PaginatedTable/Customize/DataAvailability/TableCell.test.jsx
2
import React from 'react';
3
import { render, screen, fireEvent } from '@testing-library/react';
4
import DataAvailabilityCellView, { studyDisposition } from './TableCell';
5

NEW
6
describe('studyDisposition', () => {
×
NEW
7
  test('should return "embargo" when input is "Under Embargo" (case-insensitive)', () => {
×
NEW
8
    expect(studyDisposition('Under Embargo')).toBe('embargo');
×
NEW
9
    expect(studyDisposition('under embargo')).toBe('embargo');
×
NEW
10
    expect(studyDisposition('UNDER EMBARGO')).toBe('embargo');
×
11
  });
12

NEW
13
  test('should return "pending" when input is "PENDING" (case-insensitive)', () => {
×
NEW
14
    expect(studyDisposition('pending')).toBe('pending');
×
NEW
15
    expect(studyDisposition('PENDING')).toBe('pending');
×
NEW
16
    expect(studyDisposition('PeNdInG')).toBe('pending');
×
17
  });
18

NEW
19
  test('should return undefined for non-matching values', () => {
×
NEW
20
    expect(studyDisposition('available')).toBeUndefined();
×
NEW
21
    expect(studyDisposition('')).toBeUndefined();
×
NEW
22
    expect(studyDisposition('foo')).toBeUndefined();
×
23
  });
24

NEW
25
  test('throws error if value is undefined or null', () => {
×
NEW
26
    expect(() => studyDisposition(undefined)).toThrow();
×
NEW
27
    expect(() => studyDisposition(null)).toThrow();
×
28
  });
29
});
30

NEW
31
describe('DataAvailabilityCellView', () => {
×
NEW
32
  const baseProps = {
×
33
    column: {},
34
    interOpData: undefined,
35
    clinical_study_designation: 'STUDY-1',
36
    numberOfCaseFiles: 0,
37
    numberOfStudyFiles: 0,
38
    numberOfPublications: 0,
39
  };
40

NEW
41
  const hoverTooltip = container => {
×
NEW
42
    const svgIcon = container.querySelector('svg');
×
NEW
43
    if (!svgIcon) {
×
NEW
44
      throw new Error('Expected indicator icon (svg) to exist for this test.');
×
45
    }
NEW
46
    fireEvent.mouseOver(svgIcon);
×
47
  };
48

NEW
49
  test('should not render indicator when numeric value is 0 (numberOfCaseFiles)', () => {
×
NEW
50
    const { container } = render(
×
51
      <DataAvailabilityCellView
52
        {...baseProps}
53
        dataField="numberOfCaseFiles"
54
        numberOfCaseFiles={0}
55
      />
56
    );
57

NEW
58
    expect(container.querySelector('svg')).toBeNull();
×
59
  });
60

NEW
61
  test('should render indicator and show tooltip with correct text for numberOfCaseFiles', async () => {
×
NEW
62
    const { container } = render(
×
63
      <DataAvailabilityCellView
64
        {...baseProps}
65
        dataField="numberOfCaseFiles"
66
        numberOfCaseFiles={3}
67
      />
68
    );
69

NEW
70
    expect(container.querySelector('svg')).not.toBeNull();
×
71

NEW
72
    hoverTooltip(container);
×
73

NEW
74
    const tooltip = await screen.findByRole('tooltip');
×
NEW
75
    expect(tooltip).not.toBeNull();
×
NEW
76
    expect(tooltip.textContent).toContain('3 Case File(s)');
×
77
  });
78

NEW
79
  test('should render indicator and show tooltip with correct text for numberOfStudyFiles', async () => {
×
NEW
80
    const { container } = render(
×
81
      <DataAvailabilityCellView
82
        {...baseProps}
83
        dataField="numberOfStudyFiles"
84
        numberOfStudyFiles={5}
85
      />
86
    );
87

NEW
88
    expect(container.querySelector('svg')).not.toBeNull();
×
89

NEW
90
    hoverTooltip(container);
×
91

NEW
92
    const tooltip = await screen.findByRole('tooltip');
×
NEW
93
    expect(tooltip).not.toBeNull();
×
NEW
94
    expect(tooltip.textContent).toContain('5 Study File(s)');
×
95
  });
96

NEW
97
  test('should render indicator when value > 0 for numberOfImageCollections and use studyData count in tooltip', async () => {
×
NEW
98
    const interOpData = {
×
99
      externalDataOverview: [
100
        {
101
          clinical_study_designation: 'STUDY-1',
102
          numberOfImageCollections: 7,
103
        },
104
      ],
105
    };
106

NEW
107
    const { container } = render(
×
108
      <DataAvailabilityCellView
109
        {...baseProps}
110
        dataField="numberOfImageCollections"
111
        interOpData={interOpData}
112
        numberOfImageCollections={1}
113
      />
114
    );
115

NEW
116
    expect(container.querySelector('svg')).not.toBeNull();
×
117

NEW
118
    hoverTooltip(container);
×
119

NEW
120
    const tooltip = await screen.findByRole('tooltip');
×
NEW
121
    expect(tooltip).not.toBeNull();
×
NEW
122
    expect(tooltip.textContent).toContain('7 Image Collection(s)');
×
123
  });
124

NEW
125
  test('should not render indicator when numberOfPublications is 0', () => {
×
NEW
126
    const { container } = render(
×
127
      <DataAvailabilityCellView
128
        {...baseProps}
129
        dataField="numberOfPublications"
130
        numberOfPublications={0}
131
      />
132
    );
133

NEW
134
    expect(container.querySelector('svg')).toBeNull();
×
135
  });
136

NEW
137
  test('should render indicator and show tooltip with correct text for numberOfPublications > 0', async () => {
×
NEW
138
    const { container } = render(
×
139
      <DataAvailabilityCellView
140
        {...baseProps}
141
        dataField="numberOfPublications"
142
        numberOfPublications={2}
143
      />
144
    );
145

NEW
146
    expect(container.querySelector('svg')).not.toBeNull();
×
147

NEW
148
    hoverTooltip(container);
×
149

NEW
150
    const tooltip = await screen.findByRole('tooltip');
×
NEW
151
    expect(tooltip).not.toBeNull();
×
NEW
152
    expect(tooltip.textContent).toContain('2 Publication(s)');
×
153
  });
154

NEW
155
  test('should render indicator and CRDC links list in tooltip when dataField is CRDCLinksText and links exist', async () => {
×
NEW
156
    const interOpData = {
×
157
      externalDataOverview: [
158
        {
159
          clinical_study_designation: 'STUDY-1',
160
          CRDCLinks: [
161
            { repository: 'RepoA', url: 'https://example.com/a' },
162
            { repository: 'RepoB', url: 'api failed' },
163
          ],
164
        },
165
      ],
166
    };
167

NEW
168
    const { container } = render(
×
169
      <DataAvailabilityCellView
170
        {...baseProps}
171
        dataField="CRDCLinksText"
172
        interOpData={interOpData}
173
        clinical_study_designation="STUDY-1"
174
      />
175
    );
176

NEW
177
    expect(container.querySelector('svg')).not.toBeNull();
×
178

NEW
179
    hoverTooltip(container);
×
180

NEW
181
    const tooltip = await screen.findByRole('tooltip');
×
NEW
182
    expect(tooltip).not.toBeNull();
×
183

NEW
184
    const link = tooltip.querySelector('a[href="https://example.com/a"]');
×
NEW
185
    expect(link).not.toBeNull();
×
NEW
186
    expect(link.textContent).toContain('RepoA | ICDC-STUDY-1');
×
187

NEW
188
    expect(tooltip.textContent).toContain('RepoB | api failed');
×
189
  });
190

NEW
191
  test('should not render indicator for CRDCLinksText when current study has no CRDCLinks', () => {
×
NEW
192
    const interOpData = {
×
193
      externalDataOverview: [
194
        {
195
          clinical_study_designation: 'STUDY-1',
196
          CRDCLinks: [],
197
        },
198
      ],
199
    };
200

NEW
201
    const { container } = render(
×
202
      <DataAvailabilityCellView
203
        {...baseProps}
204
        dataField="CRDCLinksText"
205
        interOpData={interOpData}
206
        clinical_study_designation="STUDY-1"
207
      />
208
    );
209

NEW
210
    expect(container.querySelector('svg')).toBeNull();
×
211
  });
212

NEW
213
  test('should handle empty interOpData gracefully (no crash) and not render indicator when value is falsy', () => {
×
NEW
214
    const { container } = render(
×
215
      <DataAvailabilityCellView
216
        {...baseProps}
217
        dataField="numberOfStudyFiles"
218
        numberOfStudyFiles={0}
219
        interOpData={undefined}
220
      />
221
    );
222

NEW
223
    expect(container.querySelector('svg')).toBeNull();
×
224
  });
225
});
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc