Skip to content

Commit 61b7e18

Browse files
authored
Merge pull request topcoder-platform#221 from topcoder-platform/integration-v5-challenge-api
Integration v5 challenge api
2 parents b7816e5 + 69fecea commit 61b7e18

34 files changed

+11204
-9099
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- attach_workspace:
2929
at: .
3030
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
31-
- run: npm publish
31+
- run: npm publish --tag test-release
3232
# dont change anything
3333
workflows:
3434
version: 2

__tests__/__snapshots__/index.js.snap

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ Object {
111111
"getSubtrackChallengesInit": [Function],
112112
"getUserMarathonDone": [Function],
113113
"getUserMarathonInit": [Function],
114+
"getUserResourcesDone": [Function],
115+
"getUserResourcesInit": [Function],
114116
"getUserSrmDone": [Function],
115117
"getUserSrmInit": [Function],
116118
},
@@ -223,9 +225,9 @@ Object {
223225
"setEndDate": [Function],
224226
"setReviewOpportunityType": [Function],
225227
"setStartDate": [Function],
226-
"setSubtracks": [Function],
227228
"setTags": [Function],
228229
"setText": [Function],
230+
"setTypes": [Function],
229231
},
230232
},
231233
"errors": Object {
@@ -303,7 +305,6 @@ Object {
303305
"default": undefined,
304306
"getService": [Function],
305307
"normalizeChallenge": [Function],
306-
"normalizeChallengeDetails": [Function],
307308
},
308309
"communities": Object {
309310
"default": undefined,
@@ -340,6 +341,7 @@ Object {
340341
"reviewOpportunities": Object {
341342
"default": undefined,
342343
"getReviewOpportunitiesService": [Function],
344+
"normalizeChallenges": [Function],
343345
},
344346
"submissions": Object {
345347
"default": undefined,
@@ -370,9 +372,10 @@ Object {
370372
},
371373
"tc": Object {
372374
"COMPETITION_TRACKS": Object {
373-
"DATA_SCIENCE": "data_science",
374-
"DESIGN": "design",
375-
"DEVELOP": "develop",
375+
"DATA_SCIENCE": "Data Science",
376+
"DESIGN": "Design",
377+
"DEVELOP": "Development",
378+
"QA": "Quality Assurance",
376379
},
377380
"REVIEW_OPPORTUNITY_TYPES": Object {
378381
"Contest Review": "Review",

__tests__/actions/__snapshots__/challenge.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`challenge.fetchChallengeInit 1`] = `
44
Object {
5-
"payload": "12345",
5+
"payload": "123456789",
66
"type": "CHALLENGE/GET_DETAILS_INIT",
77
}
88
`;
@@ -16,7 +16,7 @@ Object {
1616

1717
exports[`challenge.fetchSubmissionsInit 1`] = `
1818
Object {
19-
"payload": "12345",
19+
"payload": "123456789",
2020
"type": "CHALLENGE/GET_SUBMISSIONS_INIT",
2121
}
2222
`;

__tests__/actions/auth.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
const MOCK_GROUPS_REQ_URL = 'https://api.topcoder-dev.com/v3/groups?memberId=12345&membershipType=user';
1+
const MOCK_GROUPS_REQ_URL = 'https://api.topcoder-dev.com/v5/groups?memberId=12345&membershipType=user';
22
const MOCK_PROFILE_REQ_URL = 'https://api.topcoder-dev.com/v3/members/username12345';
33

44
jest.mock('isomorphic-fetch', () => jest.fn(url => Promise.resolve({
5+
ok: true,
56
json: () => {
67
let content;
78
switch (url) {
8-
case MOCK_GROUPS_REQ_URL: content = ['Group1', 'Group2']; break;
9-
case MOCK_PROFILE_REQ_URL: content = { userId: 12345 }; break;
9+
case MOCK_GROUPS_REQ_URL:
10+
content = ['Group1', 'Group2'];
11+
break;
12+
case MOCK_PROFILE_REQ_URL:
13+
content = { result: { content: { userId: 12345 }, status: 200 } };
14+
break;
1015
default: throw new Error('Unexpected URL!');
1116
}
12-
return {
13-
result: { content, status: 200 },
14-
};
17+
return content;
1518
},
1619
})));
1720

__tests__/actions/challenge.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ import { actions } from '../../src';
33
jest.mock('../../src/services/challenges');
44

55
test('challenge.fetchChallengeInit', () => {
6-
expect(actions.challenge.getDetailsInit(12345)).toMatchSnapshot();
6+
expect(actions.challenge.getDetailsInit(123456789)).toMatchSnapshot();
77
});
88

99
test('challenge.fetchSubmissionsInit', () => {
10-
expect(actions.challenge.getSubmissionsInit(12345)).toMatchSnapshot();
10+
expect(actions.challenge.getSubmissionsInit(123456789)).toMatchSnapshot();
1111
});
1212

1313

1414
test('challenge.getDetailsDone', () => {
15-
expect(actions.challenge.getDetailsDone(12345)).toMatchSnapshot();
15+
expect(actions.challenge.getDetailsDone(123456789)).toMatchSnapshot();
1616
});
1717

1818
test('challenge.fetchSubmissionsDone', () => {
19-
expect(actions.challenge.getSubmissionsDone(12345, {})).toMatchSnapshot();
19+
expect(actions.challenge.getSubmissionsDone(123456789, {})).toMatchSnapshot();
2020
});
2121

2222
test('challenge.getActiveChallengesCountInit', () => {

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