• 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/NavBar/NavBarContainer.generated.test.js
1
// src/components/NavBar/NavBarContainer.test.js
2

3
import React from 'react';
4
import { Provider } from 'react-redux';
5
import { configureStore } from '@reduxjs/toolkit';
6
import { render, cleanup } from '@testing-library/react';
7
import { Router } from 'react-router-dom';
8
import { createMemoryHistory } from 'history';
9

10
import layoutReducer from '../Layout/LayoutState';
11

NEW
12
jest.mock('./NavBarView', () => jest.fn(() => null));
×
13
import NavBarView from './NavBarView';
14

15
import NavBarContainer from './NavBarContainer';
16

NEW
17
afterEach(() => {
×
NEW
18
  cleanup();
×
NEW
19
  jest.clearAllMocks();
×
20
});
21

22
function makeStore(preloadedFilesId) {
NEW
23
  const cartReducer = (state = { filesId: preloadedFilesId }, _action) => state;
×
24

NEW
25
  return configureStore({
×
26
    reducer: {
27
      cartReducer,
28
      layout: layoutReducer,
29
    },
30
  });
31
}
32

33
function renderWithProviders(ui, { store, history }) {
NEW
34
  return render(
×
35
    <Provider store={store}>
36
      <Router history={history}>{ui}</Router>
37
    </Provider>
38
  );
39
}
40

NEW
41
describe('NavBarContainer', () => {
×
NEW
42
  test('maps cartFieldIds from state.cartReducer.filesId', () => {
×
NEW
43
    const filesId = ['file-1', 'file-2', 'file-3'];
×
NEW
44
    const store = makeStore(filesId);
×
NEW
45
    const history = createMemoryHistory({ initialEntries: ['/start'] });
×
46

NEW
47
    renderWithProviders(<NavBarContainer />, { store, history });
×
48

NEW
49
    expect(NavBarView).toHaveBeenCalled();
×
50
    const lastProps =
NEW
51
      NavBarView.mock.calls[NavBarView.mock.calls.length - 1][0];
×
NEW
52
    expect(lastProps.cartFieldIds).toEqual(filesId);
×
53
  });
54

NEW
55
  test('passes toggleSidebar prop that dispatches the correct action', () => {
×
NEW
56
    const filesId = [];
×
NEW
57
    const store = makeStore(filesId);
×
NEW
58
    const history = createMemoryHistory({ initialEntries: ['/start'] });
×
59

NEW
60
    renderWithProviders(<NavBarContainer />, { store, history });
×
61

62
    const lastProps =
NEW
63
      NavBarView.mock.calls[NavBarView.mock.calls.length - 1][0];
×
NEW
64
    expect(typeof lastProps.toggleSidebar).toBe('function');
×
65

NEW
66
    expect(store.getState().layout.isSidebarOpened).toBe(true);
×
67

NEW
68
    lastProps.toggleSidebar();
×
69

NEW
70
    expect(store.getState().layout.isSidebarOpened).toBe(false);
×
71
  });
72

NEW
73
  test('re-renders when location pathname changes (shouldComponentUpdate returns true)', () => {
×
NEW
74
    const store = makeStore(['x']);
×
NEW
75
    const history = createMemoryHistory({ initialEntries: ['/a'] });
×
76

NEW
77
    renderWithProviders(<NavBarContainer />, { store, history });
×
78

NEW
79
    const initialRenderCount = NavBarView.mock.calls.length;
×
80

NEW
81
    history.push('/b');
×
82

NEW
83
    const afterPushRenderCount = NavBarView.mock.calls.length;
×
NEW
84
    expect(afterPushRenderCount).toBeGreaterThan(initialRenderCount);
×
85
  });
86

NEW
87
  test('re-renders even when navigating to the same pathname due to current shouldComponentUpdate implementation', () => {
×
NEW
88
    const store = makeStore(['y']);
×
NEW
89
    const history = createMemoryHistory({ initialEntries: ['/same'] });
×
90

NEW
91
    renderWithProviders(<NavBarContainer />, { store, history });
×
92

NEW
93
    const before = NavBarView.mock.calls.length;
×
94

NEW
95
    history.push('/same');
×
96

NEW
97
    const after = NavBarView.mock.calls.length;
×
NEW
98
    expect(after).toBeGreaterThan(before);
×
99
  });
100

NEW
101
  test('passes through undefined cartFieldIds when state.cartReducer.filesId is undefined', () => {
×
NEW
102
    const store = makeStore(undefined);
×
NEW
103
    const history = createMemoryHistory({ initialEntries: ['/'] });
×
104

NEW
105
    renderWithProviders(<NavBarContainer />, { store, history });
×
106

107
    const lastProps =
NEW
108
      NavBarView.mock.calls[NavBarView.mock.calls.length - 1][0];
×
NEW
109
    expect(lastProps.cartFieldIds).toBeUndefined();
×
110
  });
111
});
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