Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: topcoder-platform/topcoder-react-lib
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 66e4be1
Choose a base ref
...
head repository: topcoder-platform/topcoder-react-lib
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c59092b
Choose a head ref
Loading
23 changes: 19 additions & 4 deletions __tests__/__snapshots__/index.js.snap
Original file line number Diff line number Diff line change
@@ -111,6 +111,8 @@ Object {
"getSubtrackChallengesInit": [Function],
"getUserMarathonDone": [Function],
"getUserMarathonInit": [Function],
"getUserResourcesDone": [Function],
"getUserResourcesInit": [Function],
"getUserSrmDone": [Function],
"getUserSrmInit": [Function],
},
@@ -223,9 +225,9 @@ Object {
"setEndDate": [Function],
"setReviewOpportunityType": [Function],
"setStartDate": [Function],
"setSubtracks": [Function],
"setTags": [Function],
"setText": [Function],
"setTypes": [Function],
},
},
"errors": Object {
@@ -370,9 +372,22 @@ Object {
},
"tc": Object {
"COMPETITION_TRACKS": Object {
"DATA_SCIENCE": "data_science",
"DESIGN": "design",
"DEVELOP": "develop",
"DATA_SCIENCE": "Data Science",
"DESIGN": "Design",
"DEVELOP": "Development",
"QA": "Quality Assurance",
},
"OLD_COMPETITION_TRACKS": Object {
"DATA_SCIENCE": "DATA_SCIENCE",
"DESIGN": "DESIGN",
"DEVELOP": "DEVELOP",
"QA": "QA",
},
"OLD_SUBTRACKS": Object {
"BUG_HUNT": "BUG_HUNT",
"TESTING_COMPETITION": "TESTING_COMPETITION",
"TEST_SCENARIOS": "TEST_SCENARIOS",
"TEST_SUITES": "TEST_SUITES",
},
"REVIEW_OPPORTUNITY_TYPES": Object {
"Contest Review": "Review",
4 changes: 2 additions & 2 deletions __tests__/actions/__snapshots__/challenge.js.snap
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

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

exports[`challenge.fetchSubmissionsInit 1`] = `
Object {
"payload": "12345",
"payload": "123456789",
"type": "CHALLENGE/GET_SUBMISSIONS_INIT",
}
`;
15 changes: 9 additions & 6 deletions __tests__/actions/auth.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
const MOCK_GROUPS_REQ_URL = 'https://api.topcoder-dev.com/v3/groups?memberId=12345&membershipType=user';
const MOCK_GROUPS_REQ_URL = 'https://api.topcoder-dev.com/v5/groups?memberId=12345&membershipType=user';
const MOCK_PROFILE_REQ_URL = 'https://api.topcoder-dev.com/v3/members/username12345';

jest.mock('isomorphic-fetch', () => jest.fn(url => Promise.resolve({
ok: true,
json: () => {
let content;
switch (url) {
case MOCK_GROUPS_REQ_URL: content = ['Group1', 'Group2']; break;
case MOCK_PROFILE_REQ_URL: content = { userId: 12345 }; break;
case MOCK_GROUPS_REQ_URL:
content = ['Group1', 'Group2'];
break;
case MOCK_PROFILE_REQ_URL:
content = { result: { content: { userId: 12345 }, status: 200 } };
break;
default: throw new Error('Unexpected URL!');
}
return {
result: { content, status: 200 },
};
return content;
},
})));

8 changes: 4 additions & 4 deletions __tests__/actions/challenge.js
Original file line number Diff line number Diff line change
@@ -3,20 +3,20 @@ import { actions } from '../../src';
jest.mock('../../src/services/challenges');

test('challenge.fetchChallengeInit', () => {
expect(actions.challenge.getDetailsInit(12345)).toMatchSnapshot();
expect(actions.challenge.getDetailsInit(123456789)).toMatchSnapshot();
});

test('challenge.fetchSubmissionsInit', () => {
expect(actions.challenge.getSubmissionsInit(12345)).toMatchSnapshot();
expect(actions.challenge.getSubmissionsInit(123456789)).toMatchSnapshot();
});


test('challenge.getDetailsDone', () => {
expect(actions.challenge.getDetailsDone(12345)).toMatchSnapshot();
expect(actions.challenge.getDetailsDone(123456789)).toMatchSnapshot();
});

test('challenge.fetchSubmissionsDone', () => {
expect(actions.challenge.getSubmissionsDone(12345, {})).toMatchSnapshot();
expect(actions.challenge.getSubmissionsDone(123456789, {})).toMatchSnapshot();
});

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