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

CBIIT / bento-icdc-frontend / 26531437966

27 May 2026 06:43PM UTC coverage: 17.253% (-8.5%) from 25.73%
26531437966

Pull #1607

github

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

306 of 2599 branches covered (11.77%)

Branch coverage included in aggregate %.

1 of 4403 new or added lines in 76 files covered. (0.02%)

2 existing lines in 2 files now uncovered.

2197 of 11909 relevant lines covered (18.45%)

0.41 hits per line

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

0.0
/src/components/PaginatedTable/Customize/ExtendedView.generated.test.js
1
// src/components/PaginatedTable/Customize/ExtendedView.generated.test.js
2

3
import { ExtendedViewConfig } from './ExtendedView';
4
import { useApolloClient } from '@apollo/client';
5
import { downloadJson } from '../utils';
6

NEW
7
jest.mock('@apollo/client', () => ({
×
8
  useApolloClient: jest.fn(),
9
}));
10

NEW
11
jest.mock('../utils', () => ({
×
12
  downloadJson: jest.fn(),
13
}));
14

NEW
15
describe('ExtendedViewConfig', () => {
×
NEW
16
  const mockQuery = jest.fn();
×
17

NEW
18
  beforeEach(() => {
×
NEW
19
    jest.clearAllMocks();
×
NEW
20
    useApolloClient.mockReturnValue({
×
21
      query: mockQuery,
22
    });
23
  });
24

NEW
25
  test('returns null when extendedViewConfig is missing', () => {
×
NEW
26
    expect(ExtendedViewConfig({})).toBeNull();
×
NEW
27
    expect(useApolloClient).not.toHaveBeenCalled();
×
28
  });
29

NEW
30
  test('returns extendedViewConfig when customDownload is falsy', () => {
×
NEW
31
    const config = {
×
32
      extendedViewConfig: {
33
        download: {
34
          customDownload: false,
35
          query: 'FAKE_QUERY',
36
        },
37
      },
38
    };
39

NEW
40
    const result = ExtendedViewConfig(config);
×
41

NEW
42
    expect(result).toBe(config.extendedViewConfig);
×
NEW
43
    expect(config.extendedViewConfig.download.downloadTable).toBeUndefined();
×
NEW
44
    expect(useApolloClient).not.toHaveBeenCalled();
×
NEW
45
    expect(downloadJson).not.toHaveBeenCalled();
×
46
  });
47

NEW
48
  test('attaches downloadTable when customDownload is truthy', () => {
×
NEW
49
    const config = {
×
50
      paginationAPIField: 'items',
51
      extendedViewConfig: {
52
        download: {
53
          customDownload: true,
54
          query: 'FAKE_QUERY',
55
          header: ['id'],
56
          keysToInclude: ['id'],
57
          fileName: 'test',
58
        },
59
      },
60
    };
61

NEW
62
    const result = ExtendedViewConfig(config);
×
63

NEW
64
    expect(result).toBe(config.extendedViewConfig);
×
NEW
65
    expect(typeof config.extendedViewConfig.download.downloadTable).toBe(
×
66
      'function'
67
    );
NEW
68
    expect(useApolloClient).toHaveBeenCalledTimes(1);
×
69
  });
70

NEW
71
  test('downloadTable queries with default variables and calls downloadJson on success', async () => {
×
NEW
72
    const dataRows = [{ id: 1 }, { id: 2 }];
×
NEW
73
    mockQuery.mockResolvedValueOnce({
×
74
      data: { items: dataRows },
75
    });
76

NEW
77
    const config = {
×
78
      paginationAPIField: 'items',
79
      extendedViewConfig: {
80
        download: {
81
          customDownload: true,
82
          query: 'FAKE_QUERY',
83
          header: ['id'],
84
          keysToInclude: ['id'],
85
          fileName: 'test',
86
        },
87
      },
88
    };
89

NEW
90
    const result = ExtendedViewConfig(config);
×
NEW
91
    const { download } = result;
×
92

NEW
93
    download.downloadTable();
×
94

NEW
95
    await mockQuery.mock.results[0].value;
×
96

NEW
97
    expect(mockQuery).toHaveBeenCalledTimes(1);
×
NEW
98
    expect(mockQuery).toHaveBeenCalledWith({
×
99
      query: download.query,
100
      variables: {
101
        offset: 0,
102
        first: 10000,
103
      },
104
    });
NEW
105
    expect(downloadJson).toHaveBeenCalledTimes(1);
×
NEW
106
    expect(downloadJson).toHaveBeenCalledWith(dataRows, download);
×
107
  });
108

NEW
109
  test('downloadTable merges provided filters into query variables', async () => {
×
NEW
110
    mockQuery.mockResolvedValueOnce({
×
111
      data: { items: [] },
112
    });
113

NEW
114
    const config = {
×
115
      paginationAPIField: 'items',
116
      extendedViewConfig: {
117
        download: {
118
          customDownload: true,
119
          query: 'FAKE_QUERY',
120
          header: ['id'],
121
          keysToInclude: ['id'],
122
          fileName: 'test',
123
        },
124
      },
125
    };
126

NEW
127
    const result = ExtendedViewConfig(config);
×
NEW
128
    const { download } = result;
×
129

NEW
130
    download.downloadTable({
×
131
      project: 'X',
132
      status: 'ACTIVE',
133
    });
134

NEW
135
    await mockQuery.mock.results[0].value;
×
136

NEW
137
    expect(mockQuery).toHaveBeenCalledTimes(1);
×
NEW
138
    expect(mockQuery).toHaveBeenCalledWith({
×
139
      query: download.query,
140
      variables: {
141
        project: 'X',
142
        status: 'ACTIVE',
143
        offset: 0,
144
        first: 10000,
145
      },
146
    });
NEW
147
    expect(downloadJson).toHaveBeenCalledTimes(1);
×
148
  });
149

NEW
150
  test('does not call downloadJson when pagination field is missing', async () => {
×
NEW
151
    mockQuery.mockResolvedValueOnce({
×
152
      data: {},
153
    });
154

NEW
155
    const config = {
×
156
      paginationAPIField: 'items',
157
      extendedViewConfig: {
158
        download: {
159
          customDownload: true,
160
          query: 'FAKE_QUERY',
161
          header: ['id'],
162
          keysToInclude: ['id'],
163
          fileName: 'test',
164
        },
165
      },
166
    };
167

NEW
168
    const result = ExtendedViewConfig(config);
×
NEW
169
    const { download } = result;
×
170

NEW
171
    download.downloadTable({});
×
172

NEW
173
    await mockQuery.mock.results[0].value;
×
174

NEW
175
    expect(mockQuery).toHaveBeenCalledTimes(1);
×
NEW
176
    expect(downloadJson).not.toHaveBeenCalled();
×
177
  });
178

NEW
179
  test('throws TypeError when download object is missing', () => {
×
NEW
180
    const config = {
×
181
      extendedViewConfig: {},
182
    };
183

NEW
184
    expect(() => ExtendedViewConfig(config)).toThrow(TypeError);
×
185
  });
186
});
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