• 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/AddToCartDialog/dialogThemeConfig.generated.test.jsx
1
import React from 'react';
2
import { cleanup, render, screen } from '@testing-library/react';
3
import '@testing-library/jest-dom/extend-expect';
4
import { useTheme } from '@material-ui/core/styles';
5
import DialogThemeProvider from './dialogThemeConfig.jsx';
6

NEW
7
jest.mock('../../themes', () => {
×
NEW
8
  const lightTheme = { overrides: {} };
×
NEW
9
  const darkTheme = { overrides: {} };
×
NEW
10
  const namedOverrides = {
×
11
    typography: {
12
      fontSize: 14,
13
    },
14
  };
15

NEW
16
  return {
×
17
    __esModule: true,
18
    default: {
19
      light: lightTheme,
20
      dark: darkTheme,
21
    },
22
    overrides: namedOverrides,
23
  };
24
});
25

NEW
26
const getThemesMock = () => jest.requireMock('../../themes');
×
27

NEW
28
const ThemeCaptureChild = ({ onTheme, label = 'child' }) => {
×
NEW
29
  const theme = useTheme();
×
30

NEW
31
  React.useEffect(() => {
×
NEW
32
    onTheme(theme);
×
33
  }, [onTheme, theme]);
34

NEW
35
  return <div data-testid="child">{label}</div>;
×
36
};
37

NEW
38
describe('DialogThemeProvider', () => {
×
NEW
39
  const consoleErrorSpy = jest
×
40
    .spyOn(console, 'error')
41
    .mockImplementation(() => {});
42

NEW
43
  beforeEach(() => {
×
NEW
44
    const themesMock = getThemesMock();
×
NEW
45
    themesMock.default.light.overrides = {};
×
NEW
46
    themesMock.default.dark.overrides = {};
×
47
  });
48

NEW
49
  afterEach(() => {
×
NEW
50
    cleanup();
×
NEW
51
    jest.clearAllMocks();
×
52
  });
53

NEW
54
  afterAll(() => {
×
NEW
55
    consoleErrorSpy.mockRestore();
×
56
  });
57

NEW
58
  test('renders children and provides the expected theme overrides', async () => {
×
NEW
59
    let capturedTheme = null;
×
60

NEW
61
    render(
×
62
      <DialogThemeProvider>
63
        <ThemeCaptureChild
64
          onTheme={theme => {
NEW
65
            capturedTheme = theme;
×
66
          }}
67
        />
68
      </DialogThemeProvider>
69
    );
70

NEW
71
    await screen.findByTestId('child');
×
72

NEW
73
    expect(capturedTheme).toBeTruthy();
×
NEW
74
    expect(screen.getByTestId('child')).toHaveTextContent('child');
×
75

NEW
76
    expect(capturedTheme.overrides).toBeTruthy();
×
NEW
77
    expect(capturedTheme.overrides.MuiDialog).toEqual({
×
78
      paper: {
79
        width: '431px',
80
        height: '200px',
81
        borderRadius: '25px !important',
82
        textAlign: 'center',
83
        backgroundColor: '#E8DFDC !important',
84
        border: '2px solid #A61401',
85
      },
86
    });
87

NEW
88
    expect(capturedTheme.overrides.MuiDialogContent).toEqual({
×
89
      root: {
90
        padding: '40px 20px 0px 20px !important',
91
      },
92
    });
93

NEW
94
    expect(capturedTheme.overrides.MuiButton).toEqual({
×
95
      root: {
96
        width: '133px',
97
        height: '45px',
98
      },
99
    });
100

NEW
101
    expect(capturedTheme.overrides.MuiDialogActions).toEqual({
×
102
      root: {
103
        justifyContent: 'center !important',
104
        paddingBottom: '25px !important',
105
      },
106
    });
107
  });
108

NEW
109
  test('mutates themes.light.overrides with the expected keys', () => {
×
NEW
110
    render(
×
111
      <DialogThemeProvider>
112
        <div>content</div>
113
      </DialogThemeProvider>
114
    );
115

NEW
116
    const themesMock = getThemesMock();
×
117

NEW
118
    expect(themesMock.default.light.overrides.MuiDialog).toEqual({
×
119
      paper: {
120
        width: '431px',
121
        height: '200px',
122
        borderRadius: '25px !important',
123
        textAlign: 'center',
124
        backgroundColor: '#E8DFDC !important',
125
        border: '2px solid #A61401',
126
      },
127
    });
128

NEW
129
    expect(themesMock.default.light.overrides.MuiDialogContent).toEqual({
×
130
      root: {
131
        padding: '40px 20px 0px 20px !important',
132
      },
133
    });
134

NEW
135
    expect(themesMock.default.light.overrides.MuiButton).toEqual({
×
136
      root: {
137
        width: '133px',
138
        height: '45px',
139
      },
140
    });
141

NEW
142
    expect(themesMock.default.light.overrides.MuiDialogActions).toEqual({
×
143
      root: {
144
        justifyContent: 'center !important',
145
        paddingBottom: '25px !important',
146
      },
147
    });
148
  });
149

NEW
150
  test('does not throw when children is null', () => {
×
NEW
151
    expect(() => {
×
NEW
152
      render(<DialogThemeProvider>{null}</DialogThemeProvider>);
×
153
    }).not.toThrow();
154

NEW
155
    expect(screen.queryByText('content')).not.toBeInTheDocument();
×
156
  });
157

NEW
158
  test('works with arbitrary child content', async () => {
×
NEW
159
    const childText = 'Any nested UI';
×
NEW
160
    let capturedTheme = null;
×
161

NEW
162
    render(
×
163
      <DialogThemeProvider>
164
        <ThemeCaptureChild
165
          label={childText}
166
          onTheme={theme => {
NEW
167
            capturedTheme = theme;
×
168
          }}
169
        />
170
      </DialogThemeProvider>
171
    );
172

NEW
173
    await screen.findByTestId('child');
×
174

NEW
175
    expect(capturedTheme).toBeTruthy();
×
NEW
176
    expect(screen.getByTestId('child')).toHaveTextContent(childText);
×
177
  });
178
});
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