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

CBIIT / bento-icdc-frontend / 26530955228

27 May 2026 06:34PM UTC coverage: 17.321% (-8.4%) from 25.73%
26530955228

Pull #1607

github

web-flow
Merge 361b68ce9 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 4346 new or added lines in 75 files covered. (0.02%)

2 existing lines in 2 files now uncovered.

2197 of 11852 relevant lines covered (18.54%)

0.41 hits per line

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

0.0
/src/components/PaginatedTable/components/AddFilesButtons.generated.test.tsx
1
// src/components/PaginatedTable/components/AddFilesButtons.test.tsx
2

NEW
3
import React from 'react';
×
NEW
4
import { render, screen } from '@testing-library/react';
×
NEW
5
import { AddSelectedFilesButton } from './AddFilesButtons';
×
6
import type { TooltipConfig } from './AddFilesButtons';
7

8
type ButtonViewProps = {
9
  btnType?: string;
10
  title: string;
11
  clsName: string;
12
  dataKey: string;
13
  addFileQuery: string;
14
  responseKeys: string[];
15
  tooltipCofig: TooltipConfig;
16
  alertMessage: string;
17
  activeFilters: Record<string, unknown>;
18
  classes: Record<string, never>;
19
  maxFileLimit: number;
20
};
21

NEW
22
const mockButtonView = jest.fn<void, [ButtonViewProps]>();
×
23

NEW
24
jest.mock('../../../bento-core', () => ({
×
25
  ButtonView: (props: ButtonViewProps) => {
NEW
26
    mockButtonView(props);
×
NEW
27
    return <div data-testid="button-view" />;
×
28
  },
29
}));
30

NEW
31
describe('AddSelectedFilesButton', () => {
×
NEW
32
  const baseTooltipConfig: TooltipConfig = {
×
33
    src: 'path/to/icon.png',
34
    icon: 'info',
35
    alt: 'info alt',
36
    arrow: true,
37
    tooltipText: 'tooltip text',
38
    toolTipText: 'tooltip text (legacy key)',
39
    clsName: 'tooltip-class',
40
  };
41

NEW
42
  const requiredProps = {
×
43
    title: 'Add Selected Files',
44
    clsName: 'add-files-btn',
45
    dataKey: 'file_ids',
46
    addFileQuery: 'mutation addFiles { ... }',
47
    responseKeys: ['files', 'ids'],
48
    tooltipCofig: baseTooltipConfig,
49
    buttonType: 'primary',
50
    alertMessage: 'Added to cart',
51
    activeFilters: { program: ['ICDC'] },
52
  };
53

NEW
54
  beforeEach(() => {
×
NEW
55
    mockButtonView.mockClear();
×
56
  });
57

NEW
58
  const getPassedProps = (): ButtonViewProps => {
×
NEW
59
    const firstCall = mockButtonView.mock.calls[0];
×
60

NEW
61
    if (!firstCall) {
×
NEW
62
      throw new Error('ButtonView was not called');
×
63
    }
64

NEW
65
    return firstCall[0];
×
66
  };
67

NEW
68
  it('should render ButtonView once', () => {
×
NEW
69
    render(<AddSelectedFilesButton {...requiredProps} />);
×
70

NEW
71
    expect(screen.getByTestId('button-view')).toBeTruthy();
×
NEW
72
    expect(mockButtonView).toHaveBeenCalledTimes(1);
×
73
  });
74

NEW
75
  it('should pass through mapped props and fixed props', () => {
×
NEW
76
    render(<AddSelectedFilesButton {...requiredProps} />);
×
77

NEW
78
    const passedProps = getPassedProps();
×
79

NEW
80
    expect(passedProps.btnType).toBe(requiredProps.buttonType);
×
NEW
81
    expect(passedProps.title).toBe(requiredProps.title);
×
NEW
82
    expect(passedProps.clsName).toBe(requiredProps.clsName);
×
NEW
83
    expect(passedProps.dataKey).toBe(requiredProps.dataKey);
×
NEW
84
    expect(passedProps.addFileQuery).toBe(requiredProps.addFileQuery);
×
NEW
85
    expect(passedProps.responseKeys).toEqual(requiredProps.responseKeys);
×
NEW
86
    expect(passedProps.tooltipCofig).toEqual(requiredProps.tooltipCofig);
×
NEW
87
    expect(passedProps.alertMessage).toBe(requiredProps.alertMessage);
×
NEW
88
    expect(passedProps.activeFilters).toEqual(requiredProps.activeFilters);
×
89

NEW
90
    expect(passedProps.classes).toEqual({});
×
NEW
91
    expect(passedProps.maxFileLimit).toBe(10000);
×
92
  });
93

NEW
94
  it('should default alertMessage to empty string when undefined is provided', () => {
×
NEW
95
    render(
×
96
      <AddSelectedFilesButton
97
        {...{
98
          ...requiredProps,
99
          alertMessage: undefined as unknown as string,
100
        }}
101
      />
102
    );
103

NEW
104
    const passedProps = getPassedProps();
×
NEW
105
    expect(passedProps.alertMessage).toBe('');
×
106
  });
107

NEW
108
  it('should default activeFilters to empty object when undefined is provided', () => {
×
NEW
109
    render(
×
110
      <AddSelectedFilesButton
111
        {...{
112
          ...requiredProps,
113
          activeFilters: undefined as unknown as Record<string, unknown>,
114
        }}
115
      />
116
    );
117

NEW
118
    const passedProps = getPassedProps();
×
NEW
119
    expect(passedProps.activeFilters).toEqual({});
×
120
  });
121

NEW
122
  it('should handle empty responseKeys array', () => {
×
NEW
123
    render(
×
124
      <AddSelectedFilesButton
125
        {...{
126
          ...requiredProps,
127
          responseKeys: [],
128
        }}
129
      />
130
    );
131

NEW
132
    const passedProps = getPassedProps();
×
NEW
133
    expect(Array.isArray(passedProps.responseKeys)).toBe(true);
×
NEW
134
    expect(passedProps.responseKeys).toHaveLength(0);
×
135
  });
136

NEW
137
  it('should forward tooltipCofig object as-is', () => {
×
NEW
138
    const customTooltip: TooltipConfig = {
×
139
      src: 'custom.png',
140
      icon: 'help',
141
      alt: 'help alt',
142
      arrow: false,
143
      tooltipText: 'custom tooltip',
144
      toolTipText: 'custom tooltip legacy',
145
      clsName: 'custom-tooltip',
146
    };
147

NEW
148
    render(
×
149
      <AddSelectedFilesButton
150
        {...{
151
          ...requiredProps,
152
          tooltipCofig: customTooltip,
153
        }}
154
      />
155
    );
156

NEW
157
    const passedProps = getPassedProps();
×
NEW
158
    expect(passedProps.tooltipCofig).toEqual(customTooltip);
×
159
  });
160

NEW
161
  it('should pass different button types correctly (edge case)', () => {
×
NEW
162
    render(
×
163
      <AddSelectedFilesButton
164
        {...{
165
          ...requiredProps,
166
          buttonType: 'secondary',
167
        }}
168
      />
169
    );
170

NEW
171
    const passedProps = getPassedProps();
×
NEW
172
    expect(passedProps.btnType).toBe('secondary');
×
173
  });
174
});
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