Skip to content

Commit 49ba5a1

Browse files
Update auth tests to support v5 API
1 parent 0ae4e1e commit 49ba5a1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

__tests__/actions/auth.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
const MOCK_GROUPS_REQ_URL = 'https://api.topcoder-dev.com/v3/groups?memberId=12345&membershipType=user';
2-
const MOCK_PROFILE_REQ_URL = 'https://api.topcoder-dev.com/v3/members/username12345';
1+
const MOCK_GROUPS_REQ_URL = 'https://api.topcoder-dev.com/v5/groups?memberId=12345&membershipType=user';
2+
const MOCK_PROFILE_REQ_URL = 'https://api.topcoder-dev.com/v5/members/username12345';
33

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

config/test.js

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module.exports = {
22
API: {
33
V2: 'https://api.topcoder-dev.com/v2',
44
V3: 'https://api.topcoder-dev.com/v3',
5+
V5: 'https://api.topcoder-dev.com/v5',
56
},
67
dummyConfigKey: 'Dummy config value',
78
SECRET: {

0 commit comments

Comments
 (0)