Skip to content

Commit 1e01ba1

Browse files
Fixing team code replace bug on Weekly Summaries Report page
1 parent 145d6f5 commit 1e01ba1

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

src/components/Badge/__tests__/NewBadges.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ describe('NewBadges component', () => {
151151
expect(badgeImages).toHaveLength(3);
152152

153153
fireEvent.mouseEnter(badgeImages[0]);
154-
screen.findByText(/Early Bird/);
154+
await screen.findByText(/Early Bird/);
155155
});
156156

157157
it('should filter out badges earned older than a week', async () => {

src/components/Projects/WBS/wbs.test.jsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// eslint-disable-next-line no-unused-vars
12
import React from 'react';
23
import { render, screen, waitFor } from '@testing-library/react';
34
import '@testing-library/jest-dom/extend-expect';
@@ -8,8 +9,6 @@ import configureStore from 'redux-mock-store';
89
import WBS from './wbs';
910
import { setWBSStart, setWBS } from '../../../actions/wbs';
1011

11-
12-
1312
jest.mock('../../../actions/wbs', () => ({
1413
addNewWBS: jest.fn(),
1514
fetchAllWBS: jest.fn(),
@@ -45,7 +44,7 @@ describe('WBS Component', () => {
4544
frontPermissions: ['deleteWbs', 'addWbs', 'fetchAllWBS'],
4645
backPermissions: [],
4746
},
48-
role: "Manager",
47+
role: 'Manager',
4948
},
5049
},
5150
role: { roles: [] },
@@ -74,6 +73,7 @@ describe('WBS Component', () => {
7473
});
7574

7675
it('dispatches setWBSStart and setWBS when fetchAllWBS is called on mount', async () => {
76+
jest.setTimeout(10000);
7777
const mockWBSData = [{ _id: 'wbs1', wbsName: 'WBS 1' }];
7878
axios.get.mockResolvedValueOnce({ data: mockWBSData });
7979

@@ -82,11 +82,11 @@ describe('WBS Component', () => {
8282
expect(store.dispatch).toHaveBeenCalledWith(setWBSStart());
8383

8484
await waitFor(() => {
85+
expect(store.dispatch).toHaveBeenCalledWith(setWBSStart());
8586
expect(store.dispatch).toHaveBeenCalledWith(setWBS(mockWBSData));
8687
});
8788
});
8889

89-
9090
it('renders AddWBS component', () => {
9191
renderComponent();
9292
expect(screen.getByTestId('add-wbs')).toBeInTheDocument();
@@ -114,5 +114,4 @@ describe('WBS Component', () => {
114114
expect(screen.getByText('#')).toBeInTheDocument();
115115
expect(screen.getByText('Name')).toBeInTheDocument();
116116
});
117-
118-
});
117+
});

0 commit comments

Comments
 (0)