• 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/components/DataValue.generated.test.jsx
1
// src/components/PaginatedTable/Customize/components/DataValue.test.jsx
2
import React from 'react';
3
import { render, screen } from '@testing-library/react';
4
import DataValue from './DataValue';
5

NEW
6
const mockReact = React;
×
7

8
// Mock only the ToolTip from bento-core to make tests deterministic.
9
// Avoid JSX inside the factory and avoid require() to satisfy lint rules.
NEW
10
jest.mock('../../../../bento-core', () => {
×
NEW
11
  const ToolTipMock = ({ title, children }) =>
×
NEW
12
    mockReact.createElement(
×
13
      'span',
14
      { 'data-testid': 'tooltip', 'data-title': title, role: 'tooltip' },
15
      children
16
    );
NEW
17
  return { ToolTip: ToolTipMock };
×
18
});
19

NEW
20
describe('DataValue', () => {
×
NEW
21
  const renderWith = (dataField, value) =>
×
NEW
22
    render(<DataValue dataField={dataField} {...{ [dataField]: value }} />);
×
23

NEW
24
  afterEach(() => {
×
NEW
25
    jest.clearAllMocks();
×
26
  });
27

NEW
28
  it('should render plain span without ToolTip when content length is <= 90', () => {
×
NEW
29
    const value = 'a'.repeat(90);
×
NEW
30
    renderWith('name', value);
×
31

NEW
32
    expect(screen.queryByTestId('tooltip')).toBeNull();
×
NEW
33
    expect(screen.getByText(value)).toBeTruthy();
×
34
  });
35

NEW
36
  it('should render ToolTip when content length is 91', () => {
×
NEW
37
    const value = 'b'.repeat(91);
×
NEW
38
    renderWith('label', value);
×
39

NEW
40
    const tooltip = screen.getByTestId('tooltip');
×
NEW
41
    expect(tooltip).toBeTruthy();
×
NEW
42
    expect(tooltip.getAttribute('data-title')).toBe(value);
×
NEW
43
    expect(screen.getByText(value)).toBeTruthy();
×
44
  });
45

NEW
46
  it('should render ToolTip and not truncate when content length is 92', () => {
×
NEW
47
    const value = 'c'.repeat(92);
×
NEW
48
    renderWith('field', value);
×
49

NEW
50
    const tooltip = screen.getByTestId('tooltip');
×
NEW
51
    expect(tooltip).toBeTruthy();
×
NEW
52
    expect(tooltip.getAttribute('data-title')).toBe(value);
×
NEW
53
    expect(screen.getByText(value)).toBeTruthy();
×
54
  });
55

NEW
56
  it('should truncate content longer than 92 characters without rendering ToolTip', () => {
×
NEW
57
    const longValue = 'The quick brown fox jumps over the lazy dog '.repeat(3);
×
NEW
58
    const { container } = renderWith('desc', longValue);
×
59

NEW
60
    expect(screen.queryByTestId('tooltip')).toBeNull();
×
61

NEW
62
    const displayed = container.querySelector('span');
×
NEW
63
    expect(displayed).toBeTruthy();
×
64

NEW
65
    const text = displayed.textContent || '';
×
NEW
66
    expect(text).not.toEqual(longValue);
×
NEW
67
    expect(text.length).toBeLessThanOrEqual(92);
×
NEW
68
    expect(text.length).toBeGreaterThan(0);
×
69
  });
70

NEW
71
  it('should handle undefined value and render "undefined" without ToolTip', () => {
×
NEW
72
    renderWith('value', undefined);
×
73

NEW
74
    expect(screen.queryByTestId('tooltip')).toBeNull();
×
NEW
75
    expect(screen.getByText('undefined')).toBeTruthy();
×
76
  });
77

NEW
78
  it('should handle null value and render "null" without ToolTip', () => {
×
NEW
79
    renderWith('value', null);
×
80

NEW
81
    expect(screen.queryByTestId('tooltip')).toBeNull();
×
NEW
82
    expect(screen.getByText('null')).toBeTruthy();
×
83
  });
84

NEW
85
  it('should render empty string as-is without ToolTip', () => {
×
NEW
86
    const { container } = renderWith('text', '');
×
87

NEW
88
    expect(screen.queryByTestId('tooltip')).toBeNull();
×
89

NEW
90
    const spans = Array.from(container.querySelectorAll('span'));
×
NEW
91
    const emptySpan = spans.find(s => s.textContent === '');
×
NEW
92
    expect(emptySpan).toBeTruthy();
×
93
  });
94

NEW
95
  it('should coerce array values to comma-separated string and show ToolTip when long', () => {
×
NEW
96
    const arr = Array.from({ length: 50 }, (_, i) => `item${i}`);
×
NEW
97
    renderWith('items', arr);
×
98

NEW
99
    const tooltip = screen.getByTestId('tooltip');
×
NEW
100
    expect(tooltip).toBeTruthy();
×
101

NEW
102
    const expectedTitle = `${arr}`;
×
NEW
103
    expect(tooltip.getAttribute('data-title')).toBe(expectedTitle);
×
104

NEW
105
    const displayed = tooltip.textContent || '';
×
NEW
106
    expect(displayed).not.toEqual(expectedTitle);
×
NEW
107
    expect(displayed.length).toBeLessThanOrEqual(92);
×
108
  });
109

NEW
110
  it('should coerce short array values to string and not show ToolTip when short', () => {
×
NEW
111
    const arr = ['a', 'b', 'c'];
×
NEW
112
    renderWith('items', arr);
×
113

NEW
114
    expect(screen.queryByTestId('tooltip')).toBeNull();
×
NEW
115
    expect(screen.getByText('a,b,c')).toBeTruthy();
×
116
  });
117
});
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