Skip to content

Commit 505b165

Browse files
committed
review refactor
1 parent 494ee3d commit 505b165

30 files changed

+3797
-615
lines changed

__tests__/__snapshots__/index.js.snap

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Object {
1313
"dropResults": [Function],
1414
"fetchCheckpointsDone": [Function],
1515
"fetchCheckpointsInit": [Function],
16+
"getActiveChallengesCountDone": [Function],
17+
"getActiveChallengesCountInit": [Function],
1618
"getDetailsDone": [Function],
1719
"getDetailsInit": [Function],
1820
"getSubmissionsDone": [Function],
@@ -49,7 +51,8 @@ Object {
4951
"getGroupsInit": [Function],
5052
},
5153
"lookup": Object {
52-
"getApprovedSkills": [Function],
54+
"getSkillTagsDone": [Function],
55+
"getSkillTagsInit": [Function],
5356
},
5457
"memberTasks": Object {
5558
"dropAll": [Function],
@@ -77,8 +80,6 @@ Object {
7780
"deleteWebLinkInit": [Function],
7881
"getAchievementsDone": [Function],
7982
"getAchievementsInit": [Function],
80-
"getActiveChallengesCountDone": [Function],
81-
"getActiveChallengesCountInit": [Function],
8283
"getCredentialDone": [Function],
8384
"getCredentialInit": [Function],
8485
"getEmailPreferencesDone": [Function],
@@ -192,21 +193,6 @@ Object {
192193
"default": undefined,
193194
"mockAction": [Function],
194195
},
195-
"reducerFactories": Object {
196-
"authFactory": [Function],
197-
"challengeFactory": [Function],
198-
"directFactory": [Function],
199-
"errorsFactory": [Function],
200-
"groupsFactory": [Function],
201-
"lookupFactory": [Function],
202-
"memberTasksFactory": [Function],
203-
"membersFactory": [Function],
204-
"mySubmissionsManagementFactory": [Function],
205-
"profileFactory": [Function],
206-
"reviewOpportunityFactory": [Function],
207-
"statsFactory": [Function],
208-
"termsFactory": [Function],
209-
},
210196
"reducerFactory": [Function],
211197
"reducers": Object {
212198
"auth": [Function],
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`challenge.getActiveChallengesCountDone 1`] = `
4+
Object {
5+
"payload": 10,
6+
"type": "CHALLENGE/GET_ACTIVE_CHALLENGES_COUNT_DONE",
7+
}
8+
`;
9+
10+
exports[`challenge.getActiveChallengesCountInit 1`] = `
11+
Object {
12+
"type": "CHALLENGE/GET_ACTIVE_CHALLENGES_COUNT_INIT",
13+
}
14+
`;
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Module exports 1`] = `
4+
Object {
5+
"lookup": Object {
6+
"getSkillTagsDone": [Function],
7+
"getSkillTagsInit": [Function],
8+
},
9+
}
10+
`;
11+
12+
exports[`lookup.getSkillTagsDone 1`] = `
13+
Object {
14+
"payload": Array [
15+
Object {
16+
"domain": "SKILLS",
17+
"id": 251,
18+
"name": "Jekyll",
19+
"status": "APPROVED",
20+
},
21+
],
22+
"type": "LOOKUP/GET_SKILL_TAGS_DONE",
23+
}
24+
`;
25+
26+
exports[`lookup.getSkillTagsInit 1`] = `
27+
Object {
28+
"type": "LOOKUP/GET_SKILL_TAGS_INIT",
29+
}
30+
`;
Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Module exports 1`] = `
4+
Object {
5+
"profile": Object {
6+
"addSkillDone": [Function],
7+
"addSkillInit": [Function],
8+
"addWebLinkDone": [Function],
9+
"addWebLinkInit": [Function],
10+
"deletePhotoDone": [Function],
11+
"deletePhotoInit": [Function],
12+
"deleteWebLinkDone": [Function],
13+
"deleteWebLinkInit": [Function],
14+
"getAchievementsDone": [Function],
15+
"getAchievementsInit": [Function],
16+
"getCredentialDone": [Function],
17+
"getCredentialInit": [Function],
18+
"getEmailPreferencesDone": [Function],
19+
"getEmailPreferencesInit": [Function],
20+
"getExternalAccountsDone": [Function],
21+
"getExternalAccountsInit": [Function],
22+
"getExternalLinksDone": [Function],
23+
"getExternalLinksInit": [Function],
24+
"getInfoDone": [Function],
25+
"getInfoInit": [Function],
26+
"getLinkedAccountsDone": [Function],
27+
"getLinkedAccountsInit": [Function],
28+
"getSkillsDone": [Function],
29+
"getSkillsInit": [Function],
30+
"getStatsDone": [Function],
31+
"getStatsInit": [Function],
32+
"hideSkillDone": [Function],
33+
"hideSkillInit": [Function],
34+
"linkExternalAccountDone": [Function],
35+
"linkExternalAccountInit": [Function],
36+
"loadProfile": [Function],
37+
"saveEmailPreferencesDone": [Function],
38+
"saveEmailPreferencesInit": [Function],
39+
"unlinkExternalAccountDone": [Function],
40+
"unlinkExternalAccountInit": [Function],
41+
"updatePasswordDone": [Function],
42+
"updatePasswordInit": [Function],
43+
"updateProfileDone": [Function],
44+
"updateProfileInit": [Function],
45+
"uploadPhotoDone": [Function],
46+
"uploadPhotoInit": [Function],
47+
},
48+
}
49+
`;
50+
51+
exports[`profile.addSkillDone 1`] = `
52+
Object {
53+
"payload": Object {
54+
"handle": "tcscoder",
55+
"skill": Object {
56+
"tagId": 123,
57+
"tagName": "Node.js",
58+
},
59+
"skills": Array [
60+
Object {
61+
"tagId": 123,
62+
"tagName": "Node.js",
63+
},
64+
],
65+
},
66+
"type": "PROFILE/ADD_SKILL_DONE",
67+
}
68+
`;
69+
70+
exports[`profile.addWebLinkDone 1`] = `
71+
Object {
72+
"payload": Object {
73+
"data": "https://www.google.com",
74+
"handle": "tcscoder",
75+
},
76+
"type": "PROFILE/ADD_WEB_LINK_DONE",
77+
}
78+
`;
79+
80+
exports[`profile.deleteWebLinkDone 1`] = `
81+
Object {
82+
"payload": Object {
83+
"data": "https://www.google.com",
84+
"handle": "tcscoder",
85+
},
86+
"type": "PROFILE/DELETE_WEB_LINK_DONE",
87+
}
88+
`;
89+
90+
exports[`profile.getCredentialDone 1`] = `
91+
Object {
92+
"payload": Object {
93+
"credential": Object {
94+
"hasPassword": true,
95+
},
96+
},
97+
"type": "PROFILE/GET_CREDENTIAL_DONE",
98+
}
99+
`;
100+
101+
exports[`profile.getEmailPreferencesDone 1`] = `
102+
Object {
103+
"payload": Object {
104+
"subscriptions": Object {
105+
"TOPCODER_NL_DATA": true,
106+
},
107+
},
108+
"type": "PROFILE/GET_EMAIL_PREFERENCES_DONE",
109+
}
110+
`;
111+
112+
exports[`profile.getLinkedAccountsDone 1`] = `
113+
Object {
114+
"payload": Object {
115+
"profiles": Array [
116+
Object {
117+
"providerType": "github",
118+
"social": true,
119+
"userId": "623633",
120+
},
121+
],
122+
},
123+
"type": "PROFILE/GET_LINKED_ACCOUNTS_DONE",
124+
}
125+
`;
126+
127+
exports[`profile.hideSkillDone 1`] = `
128+
Object {
129+
"payload": Object {
130+
"handle": "tcscoder",
131+
"skill": Object {
132+
"tagId": 123,
133+
"tagName": "Node.js",
134+
},
135+
"skills": Array [],
136+
},
137+
"type": "PROFILE/HIDE_SKILL_DONE",
138+
}
139+
`;
140+
141+
exports[`profile.linkExternalAccountDone 1`] = `
142+
Object {
143+
"payload": Object {
144+
"data": Object {
145+
"providerType": "github",
146+
"social": true,
147+
"userId": "623633",
148+
},
149+
"handle": "tcscoder",
150+
},
151+
"type": "PROFILE/LINK_EXTERNAL_ACCOUNT_DONE",
152+
}
153+
`;
154+
155+
exports[`profile.saveEmailPreferencesDone 1`] = `
156+
Object {
157+
"payload": Object {
158+
"data": Object {
159+
"subscriptions": Object {
160+
"TOPCODER_NL_DATA": true,
161+
},
162+
},
163+
"handle": "tcscoder",
164+
},
165+
"type": "PROFILE/SAVE_EMAIL_PREFERENCES_DONE",
166+
}
167+
`;
168+
169+
exports[`profile.unlinkExternalAccountDone 1`] = `
170+
Object {
171+
"payload": Object {
172+
"handle": "tcscoder",
173+
"providerType": "github",
174+
},
175+
"type": "PROFILE/UNLINK_EXTERNAL_ACCOUNT_DONE",
176+
}
177+
`;
178+
179+
exports[`profile.updatePasswordDone 1`] = `
180+
Object {
181+
"payload": Object {
182+
"data": Object {
183+
"update": true,
184+
},
185+
"handle": "tcscoder",
186+
},
187+
"type": "PROFILE/UPDATE_PASSWORD_DONE",
188+
}
189+
`;
190+
191+
exports[`profile.updateProfileDone 1`] = `
192+
Object {
193+
"payload": Object {
194+
"handle": "tcscoder",
195+
"userId": 12345,
196+
},
197+
"type": "PROFILE/UPDATE_PROFILE_DONE",
198+
}
199+
`;
200+
201+
exports[`profile.uploadPhotoDone 1`] = `
202+
Object {
203+
"payload": Object {
204+
"handle": "tcscoder",
205+
"photoURL": "url-of-photo",
206+
},
207+
"type": "PROFILE/UPLOAD_PHOTO_DONE",
208+
}
209+
`;

__tests__/actions/challenge.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { redux } from 'topcoder-react-utils';
12
import { actions } from '../../src';
23

34
jest.mock('../../src/services/challenges');
@@ -74,3 +75,14 @@ describe('challenge.fetchSubmissionsDone', () => {
7475
submissions: 'DUMMY DATA',
7576
})));
7677
});
78+
79+
test('challenge.getActiveChallengesCountInit', () => {
80+
const actionResult = actions.challenge.getActiveChallengesCountInit();
81+
expect(actionResult).toMatchSnapshot();
82+
});
83+
84+
test('challenge.getActiveChallengesCountDone', async () => {
85+
const actionResult =
86+
await redux.resolveAction(actions.challenge.getActiveChallengesCountDone('handle', 'tokenV3'));
87+
expect(actionResult).toMatchSnapshot();
88+
});

__tests__/actions/lookup.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { redux } from 'topcoder-react-utils';
2+
13
import * as LookupService from 'services/lookup';
24
import actions from 'actions/lookup';
35

@@ -14,17 +16,16 @@ const mockLookupService = {
1416
};
1517
LookupService.getService = jest.fn().mockReturnValue(mockLookupService);
1618

19+
test('Module exports', () => expect(actions).toMatchSnapshot());
1720

18-
describe('lookup.getApprovedSkills', () => {
19-
const a = actions.lookup.getApprovedSkills();
20-
21-
test('has expected type', () => {
22-
expect(a.type).toEqual('LOOKUP/GET_APPROVED_SKILLS');
23-
});
21+
test('lookup.getSkillTagsInit', async () => {
22+
const actionResult = actions.lookup.getSkillTagsInit();
23+
expect(actionResult).toMatchSnapshot();
24+
});
2425

25-
test('Approved skills should be returned', () =>
26-
a.payload.then((res) => {
27-
expect(res).toEqual([tag]);
28-
expect(mockLookupService.getTags).toBeCalled();
29-
}));
26+
test('lookup.getSkillTagsDone', async () => {
27+
const actionResult =
28+
await redux.resolveAction(actions.lookup.getSkillTagsDone());
29+
expect(actionResult).toMatchSnapshot();
30+
expect(mockLookupService.getTags).toBeCalled();
3031
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy