Skip to content

Commit e7154a3

Browse files
authored
Merge pull request #133 from topcoder-platform/develop
login page and misc updates
2 parents 4b0c277 + c82bcf8 commit e7154a3

File tree

159 files changed

+2905
-892
lines changed

Some content is hidden

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

159 files changed

+2905
-892
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ New version of Topcoder Community website.
77

88
*Disclaimer:* Current instructions are biased towards Ubuntu 16.04. Hovewer, similar recipies should work for other OS. Should you encounter and overcome any tricky issues on other OS, you are welcome to add notes/hints into this file.
99

10-
1. You should have NodeJS 6.10.0 (other recent versions should also work fine);
10+
1. You should have NodeJS 6.10.2 (other recent versions should also work fine);
1111

1212
2. Install dependencies with one of the following commands:
1313
- `$ npm install` Installs all dependencies. Recommended for local development;

__tests__/server/server.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,23 @@ describe('Api test', () => {
4848
server = require(MODULE).default;
4949
});
5050
test('post to /api/logger', () => request(server).post('/api/logger')
51-
.send({ data: 'data' })
52-
.then((response) => {
53-
expect(response.statusCode).toBe(200);
54-
}));
51+
.send({ data: 'data' })
52+
.then((response) => {
53+
expect(response.statusCode).toBe(200);
54+
}));
5555
test('post to /api/xml2json', () => request(server).post('/api/xml2json')
56-
.send({ xml: '<xml></xml>' })
57-
.then((response) => {
58-
expect(response.text).toBe('{"xml":{}}');
59-
}));
56+
.send({ xml: '<xml></xml>' })
57+
.then((response) => {
58+
expect(response.text).toBe('{"xml":{}}');
59+
}));
6060
test('status 404', () => request(server).get('/ELB-HealthChecker/2.0')
61-
.then((response) => {
62-
expect(response.statusCode).toBe(404);
63-
}));
61+
.then((response) => {
62+
expect(response.statusCode).toBe(404);
63+
}));
6464
test('status 500', () => request(server).post('/api/logger')
65-
.then((response) => {
66-
expect(response.statusCode).toBe(500);
67-
}));
65+
.then((response) => {
66+
expect(response.statusCode).toBe(500);
67+
}));
6868
test('status 500 Internal Error', () => {
6969
process.env.NODE_ENV = 'development';
7070
jest.resetModules();

__tests__/server/tc-communities.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ describe('tc-communities api test', () => {
99
server = require(MODULE).default;
1010
});
1111
test('get community filter', () => request(server).get('/api/tc-communities')
12-
.then((response) => {
13-
expect(response.statusCode).toBe(200);
14-
}));
12+
.then((response) => {
13+
expect(response.statusCode).toBe(200);
14+
}));
1515
test('get community meta', () => request(server).get('/api/tc-communities/wipro/meta')
16-
.then((response) => {
17-
expect(response.statusCode).toBe(200);
18-
}));
16+
.then((response) => {
17+
expect(response.statusCode).toBe(200);
18+
}));
1919
test('get non-exist community meta', () => request(server).get('/api/tc-communities/noop/meta')
20-
.then((response) => {
21-
expect(response.statusCode).toBe(404);
22-
}));
20+
.then((response) => {
21+
expect(response.statusCode).toBe(404);
22+
}));
2323
});

__tests__/shared/actions/challenge.js

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,48 +21,53 @@ afterAll(() => {
2121
});
2222

2323
describe('challenge.fetchChallengeInit', () => {
24-
const a = actions.fetchChallengeInit();
24+
const a = actions.challenge.getDetailsInit(12345);
2525

2626
test('has expected type', () => {
27-
expect(a.type).toBe('FETCH_CHALLENGE_INIT');
27+
expect(a.type).toBe('CHALLENGE/GET_DETAILS_INIT');
2828
});
2929

30-
test('payload is undefined', () =>
31-
expect(a.payload).toBeUndefined());
30+
test('payload is the challenge ID, converted to string, if necessary', () =>
31+
expect(a.payload).toBe('12345'));
3232
});
3333

3434
describe('challenge.fetchSubmissionsInit', () => {
35-
const a = actions.fetchSubmissionsInit();
35+
const a = actions.challenge.getSubmissionsInit();
3636

3737
test('has expected type', () => {
38-
expect(a.type).toBe('FETCH_SUBMISSIONS_INIT');
38+
expect(a.type).toBe('CHALLENGE/GET_SUBMISSIONS_INIT');
3939
});
4040

4141
test('payload is undefined', () =>
4242
expect(a.payload).toBeUndefined());
4343
});
4444

45-
describe('challenge.fetchChallengeDone', () => {
45+
describe('challenge.getDetailsDone', () => {
4646
global.fetch = mockFetch({ result: { content: ['DUMMY DATA'] } });
4747

48-
const a = actions.fetchChallengeDone({});
48+
const a = actions.challenge.getDetailsDone(12345);
4949

5050
test('has expected type', () => {
51-
expect(a.type).toBe('FETCH_CHALLENGE_DONE');
51+
expect(a.type).toBe('CHALLENGE/GET_DETAILS_DONE');
5252
});
5353

54-
test('payload is a promise which resolves to the expected object', () =>
55-
a.payload.then(res => expect(res).toEqual('DUMMY DATA')));
54+
/* TODO: This test does not work anymore, as the action was refactored to
55+
* use challenges service for API v3 calls, while API v2 calls still happen
56+
* the way they used to. Thus, we need a better mock of fetch to test it,
57+
* or some alternative approach. */
58+
test.skip('payload is a promise which resolves to the expected object', () =>
59+
a.payload.then(res => expect(res).toEqual(
60+
['DUMMY DATA', { result: { content: ['DUMMY DATA'] } }, {}])));
5661
});
5762

5863

5964
describe('challenge.fetchSubmissionsDone', () => {
6065
global.fetch = mockFetch({ submissions: 'DUMMY DATA' });
6166

62-
const a = actions.fetchSubmissionsDone({});
67+
const a = actions.challenge.getSubmissionsDone({});
6368

6469
test('has expected type', () => {
65-
expect(a.type).toBe('FETCH_SUBMISSIONS_DONE');
70+
expect(a.type).toBe('CHALLENGE/GET_SUBMISSIONS_DONE');
6671
});
6772

6873
test('payload is a promise which resolves to the expected object', () =>

__tests__/shared/components/TopcoderHeader/__snapshots__/Auth.jsx.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ exports[`Snapshot match 1`] = `
66
>
77
<a
88
className="tc-btn-sm tc-btn-primary"
9-
href="https://accounts.topcoder-dev.com/member/registration"
9+
href="http://accounts-test.topcoder-dev.com/member/registration"
1010
>
1111
Join
1212
</a>
1313
<a
1414
className="tc-btn-sm tc-btn-default"
15-
href="https://accounts.topcoder-dev.com/member"
15+
href="http://accounts-test.topcoder-dev.com/member"
1616
>
1717
Log In
1818
</a>
@@ -25,13 +25,13 @@ exports[`Snapshot match 2`] = `
2525
>
2626
<a
2727
className="tc-btn-sm tc-btn-primary"
28-
href="https://accounts.topcoder-dev.com/member/registration"
28+
href="http://accounts-test.topcoder-dev.com/member/registration"
2929
>
3030
Join
3131
</a>
3232
<a
3333
className="tc-btn-sm tc-btn-default"
34-
href="https://accounts.topcoder-dev.com/member"
34+
href="http://accounts-test.topcoder-dev.com/member"
3535
>
3636
Log In
3737
</a>

__tests__/shared/components/TopcoderHeader/__snapshots__/index.jsx.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ exports[`Default render 1`] = `
4949
>
5050
<a
5151
className="tc-btn-sm tc-btn-primary"
52-
href="https://accounts.topcoder-dev.com/member/registration"
52+
href="http://accounts-test.topcoder-dev.com/member/registration"
5353
>
5454
Join
5555
</a>
5656
<a
5757
className="tc-btn-sm tc-btn-default"
58-
href="https://accounts.topcoder-dev.com/member"
58+
href="http://accounts-test.topcoder-dev.com/member"
5959
>
6060
Log In
6161
</a>
@@ -232,13 +232,13 @@ exports[`Render with open menu 1`] = `
232232
>
233233
<a
234234
className="tc-btn-sm tc-btn-primary"
235-
href="https://accounts.topcoder-dev.com/member/registration"
235+
href="http://accounts-test.topcoder-dev.com/member/registration"
236236
>
237237
Join
238238
</a>
239239
<a
240240
className="tc-btn-sm tc-btn-default"
241-
href="https://accounts.topcoder-dev.com/member"
241+
href="http://accounts-test.topcoder-dev.com/member"
242242
>
243243
Log In
244244
</a>

__tests__/shared/components/challenge-listing/Listing/Bucket.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const mockDatas = [{
1919
expanded: true,
2020
expand,
2121
challenges: [
22-
{ id: '1', status: 'b' },
22+
{ id: '1', status: 'b' },
2323
{
2424
id: '2',
2525
status: 'a',

0 commit comments

Comments
 (0)