Skip to content

Commit cab99c6

Browse files
committed
pipeline fail fix
1 parent 439b422 commit cab99c6

4 files changed

Lines changed: 96 additions & 109 deletions

File tree

src/actions/__tests__/weeklySummariesAction.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import axios from 'axios';
22
import * as actions from '../../constants/weeklySummaries';
33
import { ENDPOINTS } from '../../utils/URL';
44
import { fetchWeeklySummariesBegin, fetchWeeklySummariesSuccess, fetchWeeklySummariesError, getWeeklySummaries, updateWeeklySummaries } from '../weeklySummaries'
5-
import { getUserProfileActionCreator } from '../../actions/userProfile';
5+
import { getUserProfileActionCreator } from "../userProfile";
66

77

88
jest.mock('axios');

src/actions/__tests__/weeklySummariesReportActions.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ describe('Weekly Summary Report', () => {
9898

9999
describe('Update One Summary Report', () => {
100100

101-
let mockUserProfile, updatedField;
101+
let mockUserProfile; let updatedField;
102102

103103
beforeEach(() => {
104104

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,40 @@
11
import { monthlyDashboardDataReducer } from '../monthlyDashboardDataReducer';
22

33
const monthlyDashboardData = {
4-
projectName: "",
4+
projectName: '',
55
timeSpent_hrs: 0,
6-
}
6+
};
77

88
describe('Monthly Dashboard Data Reducer', () => {
9-
109
it('get monthly dashboard data', () => {
11-
12-
const newPayload = { projectName: 'Project Name', timeSpent_hrs : '0' };
10+
const newPayload = { projectName: 'Project Name', timeSpent_hrs: '0' };
1311

1412
const action = {
1513
type: 'GET_MONTHLY_DASHBOARD_DATA',
1614
payload: newPayload,
1715
};
1816

19-
const result = monthlyDashboardDataReducer(monthlyDashboardData, action );
17+
const result = monthlyDashboardDataReducer(monthlyDashboardData, action);
2018
expect(result).toEqual(newPayload);
21-
2219
});
2320

2421
it('should return the initial state when an action type is not passed', () => {
25-
26-
const result = monthlyDashboardDataReducer(monthlyDashboardData, {} );
22+
const result = monthlyDashboardDataReducer(monthlyDashboardData, {});
2723
expect(result).toEqual(monthlyDashboardData);
28-
2924
});
3025

3126
it('should return null as the initial state', () => {
32-
33-
const result = monthlyDashboardDataReducer(undefined, {} );
27+
const result = monthlyDashboardDataReducer(undefined, {});
3428
expect(result).toBeNull();
35-
3629
});
3730

38-
it('should return previous state if action type is unknown', () => {
39-
const action = {
40-
type: 'UNKNOWN_ACTION',
41-
payload: { projectName: 'Project Name', timeSpent_hrs : '0' }
42-
};
31+
it('should return previous state if action type is unknown', () => {
32+
const action = {
33+
type: 'UNKNOWN_ACTION',
34+
payload: { projectName: 'Project Name', timeSpent_hrs: '0' },
35+
};
4336

4437
const result = monthlyDashboardDataReducer(monthlyDashboardData, action);
45-
expect(result).toEqual(monthlyDashboardData);
38+
expect(result).toEqual(monthlyDashboardData);
4639
});
47-
48-
})
40+
});
Lines changed: 81 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,86 @@
1-
import { RECEIVE_TEAM_USERS, TEAM_MEMBER_ADD, TEAM_MEMBER_DELETE, FETCH_TEAM_USERS_START } from '../../constants/allTeamsConstants';
2-
import { teamUsersReducer, updateObject } from '../teamsTeamMembersReducer'
3-
4-
const teamUsersInitial = {
5-
fetching: false,
6-
fetched: false,
7-
teamMembers: [],
8-
status: 404
9-
};
1+
import {
2+
RECEIVE_TEAM_USERS,
3+
TEAM_MEMBER_ADD,
4+
TEAM_MEMBER_DELETE,
5+
FETCH_TEAM_USERS_START,
6+
} from '../../constants/allTeamsConstants';
7+
import { teamUsersReducer, updateObject } from '../teamsTeamMembersReducer';
8+
9+
// const teamUsersInitial = {
10+
// fetching: false,
11+
// fetched: false,
12+
// teamMembers: [],
13+
// status: 404,
14+
// };
1015

1116
const teamMembers = {
12-
teamMembers: [{
13-
_id: '1',
14-
firstName: 'First name',
15-
lastName: 'Last name',
16-
jobTitle: [''],
17-
teams: [],
18-
projects: ['p1', 'p2']
19-
}]
17+
teamMembers: [
18+
{
19+
_id: '1',
20+
firstName: 'First name',
21+
lastName: 'Last name',
22+
jobTitle: [''],
23+
teams: [],
24+
projects: ['p1', 'p2'],
25+
},
26+
],
2027
};
2128

2229
describe('Teams Team Members Reducer', () => {
23-
24-
it('Should receive team users', () => {
25-
26-
const expectedState = { teamMembers:{}, fetching: false, fetched: true, status: '200'};
27-
const action = {
28-
payload: {},
29-
type:RECEIVE_TEAM_USERS
30-
};
31-
32-
const result = teamUsersReducer( teamMembers, action );
33-
expect(result).toEqual(expectedState);
34-
35-
});
36-
37-
it('Should add team member to team', () => {
38-
39-
const action = {
40-
member: { _id: '2', firstName: 'First name', lastName: 'Last name' },
41-
type:TEAM_MEMBER_ADD
42-
};
43-
44-
const expectedResult = {
45-
teamMembers:[...teamMembers.teamMembers, action.member],
46-
fetching: false,
47-
fetched: true,
48-
status: '200'
49-
};
50-
51-
const result = teamUsersReducer(teamMembers, action);
52-
expect(result).toEqual(expectedResult);
53-
54-
});
55-
56-
it('Should delete member from team', () => {
57-
58-
const action = {
59-
member: { _id: '2', firstName: 'First name', lastName: 'Last name' },
60-
type: TEAM_MEMBER_DELETE
61-
};
62-
63-
const expectedResult = {
64-
teamMembers:[...teamMembers.teamMembers.filter(item => item._id !== action.member._id)],
65-
fetching: false,
66-
fetched: true,
67-
status: '200'
68-
};
69-
70-
const result = teamUsersReducer(teamMembers, action);
71-
expect(result).toEqual(expectedResult);
72-
73-
});
74-
75-
it('Should fetch teams user start', () => {
76-
77-
const expectedResult = updateObject(teamMembers, {fetching: true, fetched: false});
78-
79-
const result = teamUsersReducer( teamMembers,{ type: FETCH_TEAM_USERS_START } );
80-
expect(result).toEqual(expectedResult);
81-
82-
});
83-
84-
it('Should return initial teamMembers in default case ', () =>{
85-
86-
const result = teamUsersReducer( teamMembers, {} );
87-
expect(result).toEqual(teamMembers);
88-
89-
});
90-
91-
})
30+
it('Should receive team users', () => {
31+
const expectedState = { teamMembers: {}, fetching: false, fetched: true, status: '200' };
32+
const action = {
33+
payload: {},
34+
type: RECEIVE_TEAM_USERS,
35+
};
36+
37+
const result = teamUsersReducer(teamMembers, action);
38+
expect(result).toEqual(expectedState);
39+
});
40+
41+
it('Should add team member to team', () => {
42+
const action = {
43+
member: { _id: '2', firstName: 'First name', lastName: 'Last name' },
44+
type: TEAM_MEMBER_ADD,
45+
};
46+
47+
const expectedResult = {
48+
teamMembers: [...teamMembers.teamMembers, action.member],
49+
fetching: false,
50+
fetched: true,
51+
status: '200',
52+
};
53+
54+
const result = teamUsersReducer(teamMembers, action);
55+
expect(result).toEqual(expectedResult);
56+
});
57+
58+
it('Should delete member from team', () => {
59+
const action = {
60+
member: { _id: '2', firstName: 'First name', lastName: 'Last name' },
61+
type: TEAM_MEMBER_DELETE,
62+
};
63+
64+
const expectedResult = {
65+
teamMembers: [...teamMembers.teamMembers.filter(item => item._id !== action.member._id)],
66+
fetching: false,
67+
fetched: true,
68+
status: '200',
69+
};
70+
71+
const result = teamUsersReducer(teamMembers, action);
72+
expect(result).toEqual(expectedResult);
73+
});
74+
75+
it('Should fetch teams user start', () => {
76+
const expectedResult = updateObject(teamMembers, { fetching: true, fetched: false });
77+
78+
const result = teamUsersReducer(teamMembers, { type: FETCH_TEAM_USERS_START });
79+
expect(result).toEqual(expectedResult);
80+
});
81+
82+
it('Should return initial teamMembers in default case ', () => {
83+
const result = teamUsersReducer(teamMembers, {});
84+
expect(result).toEqual(teamMembers);
85+
});
86+
});

0 commit comments

Comments
 (0)