Skip to content

Commit 1ce0b88

Browse files
authored
Merge pull request #7 from liuliquan/settings-profile
Review refactor
2 parents 153548a + 40edda6 commit 1ce0b88

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+15238
-4951
lines changed

.circleci/config.yml

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
defaults: &defaults
2+
docker:
3+
- image: circleci/node:8.11.2
4+
15
version: 2
26
jobs:
3-
# Code testing
47
test:
5-
docker:
6-
- image: circleci/node:8.11.1
8+
<<: *defaults
79
steps:
810
- checkout
911
- restore_cache:
@@ -19,11 +21,8 @@ jobs:
1921
root: .
2022
paths:
2123
- dist
22-
23-
# NPM release
2424
release:
25-
docker:
26-
- image: circleci/node:8.11.1
25+
<<: *defaults
2726
steps:
2827
- checkout
2928
- attach_workspace:
@@ -38,12 +37,12 @@ workflows:
3837
- test:
3938
filters:
4039
tags:
41-
only: /v[0-9]+(\.[0-9]+)*/
40+
only: /.*/
4241
- release:
4342
filters:
4443
branches:
4544
ignore: /.*/
4645
tags:
4746
only: /v[0-9]+(\.[0-9]+)*/
4847
requires:
49-
- test
48+
- test

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# Topcoder React Lib
22

3+
### v0.1.0
4+
Update of dependencies.
5+
36
### v0.0.x
47
Pre-release drafts of the initial library version. A big journey starts here.

__tests__/__snapshots__/index.js.snap

+10-18
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],
@@ -61,9 +64,15 @@ Object {
6164
"dropAll": [Function],
6265
"getAchievementsDone": [Function],
6366
"getAchievementsInit": [Function],
67+
"getActiveChallengesDone": [Function],
68+
"getActiveChallengesInit": [Function],
6469
"getFinancesDone": [Function],
6570
"getFinancesInit": [Function],
71+
"getStatsDistributionDone": [Function],
72+
"getStatsDistributionInit": [Function],
6673
"getStatsDone": [Function],
74+
"getStatsHistoryDone": [Function],
75+
"getStatsHistoryInit": [Function],
6776
"getStatsInit": [Function],
6877
},
6978
"profile": Object {
@@ -77,8 +86,6 @@ Object {
7786
"deleteWebLinkInit": [Function],
7887
"getAchievementsDone": [Function],
7988
"getAchievementsInit": [Function],
80-
"getActiveChallengesCountDone": [Function],
81-
"getActiveChallengesCountInit": [Function],
8289
"getCredentialDone": [Function],
8390
"getCredentialInit": [Function],
8491
"getEmailPreferencesDone": [Function],
@@ -192,21 +199,6 @@ Object {
192199
"default": undefined,
193200
"mockAction": [Function],
194201
},
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-
},
210202
"reducerFactory": [Function],
211203
"reducers": Object {
212204
"auth": [Function],
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+
`;
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+
`;
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

+12
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+
});

0 commit comments

Comments
 (0)