Skip to content

Commit 26e414d

Browse files
committed
Merge branch 'clean-up' into develop
2 parents 4aca6bd + 80b6441 commit 26e414d

File tree

97 files changed

+6608
-664
lines changed

Some content is hidden

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

97 files changed

+6608
-664
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ __coverage__
22
.build-info
33
.sass-cache
44
dist
5-
node_modules
5+
node_modules
6+
_auto_doc_

__tests__/__snapshots__/index.js.snap

+251
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,251 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Library interface test 1`] = `
4+
Object {
5+
"actions": Object {
6+
"auth": Object {
7+
"loadProfile": [Function],
8+
"setTcTokenV2": [Function],
9+
"setTcTokenV3": [Function],
10+
},
11+
"challenge": Object {
12+
"dropCheckpoints": [Function],
13+
"dropResults": [Function],
14+
"fetchCheckpointsDone": [Function],
15+
"fetchCheckpointsInit": [Function],
16+
"getDetailsDone": [Function],
17+
"getDetailsInit": [Function],
18+
"getSubmissionsDone": [Function],
19+
"getSubmissionsInit": [Function],
20+
"loadResultsDone": [Function],
21+
"loadResultsInit": [Function],
22+
"registerDone": [Function],
23+
"registerInit": [Function],
24+
"toggleCheckpointFeedback": [Function],
25+
"unregisterDone": [Function],
26+
"unregisterInit": [Function],
27+
"updateChallengeDone": [Function],
28+
"updateChallengeInit": [Function],
29+
},
30+
"direct": Object {
31+
"dropAll": [Function],
32+
"getProjectDetailsDone": [Function],
33+
"getProjectDetailsInit": [Function],
34+
"getProjectPermissionsDone": [Function],
35+
"getProjectPermissionsInit": [Function],
36+
"getUserProjectsDone": [Function],
37+
"getUserProjectsInit": [Function],
38+
},
39+
"errors": Object {
40+
"clearAllErrorIcons": [Function],
41+
"clearError": [Function],
42+
"clearErrorIcon": [Function],
43+
"newError": [Function],
44+
"setErrorIcon": [Function],
45+
},
46+
"groups": Object {
47+
"dropGroups": [Function],
48+
"getGroupsDone": [Function],
49+
"getGroupsInit": [Function],
50+
},
51+
"memberTasks": Object {
52+
"dropAll": [Function],
53+
"getDone": [Function],
54+
"getInit": [Function],
55+
},
56+
"members": Object {
57+
"drop": [Function],
58+
"dropAll": [Function],
59+
"getAchievementsDone": [Function],
60+
"getAchievementsInit": [Function],
61+
"getFinancesDone": [Function],
62+
"getFinancesInit": [Function],
63+
"getStatsDone": [Function],
64+
"getStatsInit": [Function],
65+
},
66+
"profile": Object {
67+
"getAchievementsDone": [Function],
68+
"getAchievementsInit": [Function],
69+
"getExternalAccountsDone": [Function],
70+
"getExternalAccountsInit": [Function],
71+
"getExternalLinksDone": [Function],
72+
"getExternalLinksInit": [Function],
73+
"getInfoDone": [Function],
74+
"getInfoInit": [Function],
75+
"getSkillsDone": [Function],
76+
"getSkillsInit": [Function],
77+
"getStatsDone": [Function],
78+
"getStatsInit": [Function],
79+
"loadProfile": [Function],
80+
},
81+
"reviewOpportunity": Object {
82+
"cancelApplicationsDone": [Function],
83+
"cancelApplicationsInit": [Function],
84+
"getDetailsDone": [Function],
85+
"getDetailsInit": [Function],
86+
"submitApplicationsDone": [Function],
87+
"submitApplicationsInit": [Function],
88+
},
89+
"smp": Object {
90+
"deleteSubmissionDone": [Function],
91+
"deleteSubmissionInit": [Function],
92+
"downloadSubmission": [Function],
93+
},
94+
"stats": Object {
95+
"getCommunityStatsDone": [Function],
96+
"getCommunityStatsInit": [Function],
97+
},
98+
"terms": Object {
99+
"agreeTermDone": [Function],
100+
"agreeTermInit": [Function],
101+
"checkStatusDone": [Function],
102+
"checkStatusInit": [Function],
103+
"getDocuSignUrlDone": [Function],
104+
"getDocuSignUrlInit": [Function],
105+
"getTermDetailsDone": [Function],
106+
"getTermDetailsInit": [Function],
107+
"getTermsDone": [Function],
108+
"getTermsInit": [Function],
109+
},
110+
},
111+
"challenge": Object {
112+
"filter": Object {
113+
"addTrack": [Function],
114+
"combine": [Function],
115+
"default": undefined,
116+
"getFilterFunction": [Function],
117+
"getReviewOpportunitiesFilterFunction": [Function],
118+
"mapToBackend": [Function],
119+
"removeTrack": [Function],
120+
"setEndDate": [Function],
121+
"setReviewOpportunityType": [Function],
122+
"setStartDate": [Function],
123+
"setSubtracks": [Function],
124+
"setTags": [Function],
125+
"setText": [Function],
126+
},
127+
},
128+
"errors": Object {
129+
"ERROR_ICON_TYPES": Object {
130+
"API": "api",
131+
"NETWORK": "network",
132+
},
133+
"clearAllErrorIcons": [Function],
134+
"clearErrorIcon": [Function],
135+
"fireErrorMessage": [Function],
136+
"setErrorIcon": [Function],
137+
"setErrorsStore": [Function],
138+
},
139+
"logger": Object {
140+
"_getSourceMaps": [Function],
141+
"assert": [Function],
142+
"clear": [Function],
143+
"count": [Function],
144+
"countReset": [Function],
145+
"debug": [Function],
146+
"dir": [Function],
147+
"error": [Function],
148+
"group": [Function],
149+
"groupCollapsed": [Function],
150+
"groupEnd": [Function],
151+
"info": [Function],
152+
"log": [Function],
153+
"time": [Function],
154+
"timeEnd": [Function],
155+
"trace": [Function],
156+
"warn": [Function],
157+
},
158+
"mock": Object {
159+
"default": undefined,
160+
"mockAction": [Function],
161+
},
162+
"reducerFactory": [Function],
163+
"reducers": Object {
164+
"auth": [Function],
165+
"challenge": [Function],
166+
"direct": [Function],
167+
"errors": [Function],
168+
"groups": [Function],
169+
"memberTasks": [Function],
170+
"members": [Function],
171+
"mySubmissionsManagement": [Function],
172+
"profile": [Function],
173+
"reviewOpportunity": [Function],
174+
"stats": [Function],
175+
"terms": [Function],
176+
},
177+
"services": Object {
178+
"api": Object {
179+
"default": [Function],
180+
"getApiV2": [Function],
181+
"getApiV3": [Function],
182+
},
183+
"billing": Object {
184+
"default": [Function],
185+
"getService": [Function],
186+
},
187+
"challenge": Object {
188+
"ORDER_BY": Object {
189+
"SUBMISSION_END_DATE": "submissionEndDate",
190+
},
191+
"default": undefined,
192+
"getService": [Function],
193+
"normalizeChallenge": [Function],
194+
"normalizeChallengeDetails": [Function],
195+
},
196+
"communities": Object {
197+
"default": undefined,
198+
"getService": [Function],
199+
},
200+
"direct": Object {
201+
"default": undefined,
202+
"getService": [Function],
203+
},
204+
"groups": Object {
205+
"addDescendantGroups": [Function],
206+
"checkGroupsStatus": [Function],
207+
"checkUserGroups": [Function],
208+
"default": undefined,
209+
"getService": [Function],
210+
},
211+
"members": Object {
212+
"default": undefined,
213+
"getService": [Function],
214+
},
215+
"reviewOpportunities": Object {
216+
"default": undefined,
217+
"getReviewOpportunitiesService": [Function],
218+
},
219+
"terms": Object {
220+
"default": undefined,
221+
"getService": [Function],
222+
},
223+
"user": Object {
224+
"default": [Function],
225+
"getService": [Function],
226+
},
227+
"userSetting": Object {
228+
"default": [Function],
229+
"getUserSettingsService": [Function],
230+
},
231+
},
232+
"tc": Object {
233+
"COMPETITION_TRACKS": Object {
234+
"DATA_SCIENCE": "data_science",
235+
"DESIGN": "design",
236+
"DEVELOP": "develop",
237+
},
238+
"REVIEW_OPPORTUNITY_TYPES": Object {
239+
"Contest Review": "Review",
240+
"Iterative Review": "Iterative Review",
241+
"Spec Review": "Specification Review",
242+
},
243+
"getApiResponsePayloadV3": [Function],
244+
},
245+
"time": Object {
246+
"default": undefined,
247+
"delay": [Function],
248+
"formatDuration": [Function],
249+
},
250+
}
251+
`;

__tests__/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
test('Library interface test', () => {
2+
expect(require('../src')).toMatchSnapshot();
3+
});

__tests__/reducers/auth.js

+21-49
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { mockAction } from 'utils/mock';
12
import { redux } from 'topcoder-react-utils';
2-
import { mockAction } from '../../src/utils/mock';
33

44
const dummy = 'DUMMY';
55

@@ -10,13 +10,16 @@ const mockActions = {
1010
setTcTokenV3: mockAction('SET_TC_TOKEN_V3', 'Token V3'),
1111
},
1212
};
13-
jest.setMock(require.resolve('../../src/actions/auth'), mockActions);
13+
jest.setMock(require.resolve('actions/auth'), mockActions);
1414

15-
const { reducers } = require('../../src');
15+
jest.setMock('tc-accounts', {
16+
decodeToken: () => 'User object',
17+
isTokenExpired: () => false,
18+
});
1619

17-
let reducer;
20+
const reducers = require('reducers/auth');
1821

19-
function testReducer(istate) {
22+
function testReducer(reducer, istate) {
2023
test('Initial state', () => {
2124
const state = reducer(undefined, {});
2225
expect(state).toEqual(istate);
@@ -45,10 +48,7 @@ function testReducer(istate) {
4548
expect(state).toEqual({
4649
dummy,
4750
tokenV3: 'Token V3',
48-
user: {
49-
handle: 'username12345',
50-
userId: '12345',
51-
},
51+
user: 'User object',
5252
});
5353
});
5454

@@ -65,52 +65,24 @@ function testReducer(istate) {
6565
}
6666

6767
describe('Default reducer', () => {
68-
beforeAll(() => {
69-
reducer = reducers.auth.default;
70-
});
71-
72-
testReducer({
73-
authenticating: true,
74-
});
75-
});
76-
77-
describe('Factory without server side rendering', () => {
78-
beforeAll((done) => {
79-
reducers.auth.factory().then((res) => {
80-
reducer = res;
81-
done();
82-
});
83-
});
84-
85-
testReducer({
68+
testReducer(reducers.default, {
8669
authenticating: true,
70+
profile: null,
8771
tokenV2: '',
8872
tokenV3: '',
8973
user: null,
9074
});
9175
});
9276

93-
describe('Factory with server side rendering', () => {
94-
beforeAll((done) => {
95-
reducers.auth.factory({
96-
auth: {
97-
tokenV2: 'Token V2',
98-
tokenV3: 'Token V3',
99-
},
100-
}).then((res) => {
101-
reducer = res;
102-
done();
103-
});
104-
});
77+
describe('Factory without server side rendering', () =>
78+
reducers.factory().then(res =>
79+
testReducer(res, {})));
10580

106-
testReducer({
107-
authenticating: false,
108-
profile: 'Profile',
109-
tokenV2: 'Token V2',
110-
tokenV3: 'Token V3',
111-
user: {
112-
handle: 'username12345',
113-
userId: '12345',
81+
describe('Factory with server side rendering', () =>
82+
reducers.factory({
83+
cookies: {
84+
tcjwt: 'Token V2',
85+
v3jwt: 'Token V3',
11486
},
115-
});
116-
});
87+
}).then(res =>
88+
testReducer(res, {})));

__tests__/utils/filter.js renamed to __tests__/utils/challenge/filter.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { setText, setTags, setSubtracks, setStartDate } from '../../src/utils/filter';
1+
import { setText, setTags, setSubtracks, setStartDate } from '../../../src/utils/challenge/filter';
22

33
describe('challenge filter', () => {
44
let res;

0 commit comments

Comments
 (0)