Skip to content

Commit 38c478b

Browse files
authored
Merge pull request #531 from topcoder-platform/develop
task demo, terms for joining community
2 parents 206fa94 + 22065a7 commit 38c478b

File tree

107 files changed

+3234
-340
lines changed

Some content is hidden

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

107 files changed

+3234
-340
lines changed

.exchange-rates.cache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"disclaimer":"Usage subject to terms: https://openexchangerates.org/terms","license":"https://openexchangerates.org/license","timestamp":1507798800,"base":"USD","rates":{"AED":3.672896,"AFN":67.974,"ALL":113,"AMD":478.925,"ANG":1.77865,"AOA":165.9215,"ARS":17.4045,"AUD":1.277432,"AWG":1.790501,"AZN":1.69,"BAM":1.648856,"BBD":2,"BDT":82.288,"BGN":1.64876,"BHD":0.377213,"BIF":1746.8,"BMD":1,"BND":1.355356,"BOB":6.885986,"BRL":3.171391,"BSD":1,"BTC":0.000195885465,"BTN":65.230321,"BWP":10.283758,"BYN":1.961895,"BZD":2.008642,"CAD":1.245347,"CDF":1562.881563,"CHF":0.973707,"CLF":0.02324,"CLP":626.965409,"CNH":6.583036,"CNY":6.585567,"COP":2953.31,"CRC":572.515,"CUC":1,"CUP":25.5,"CVE":93.375,"CZK":21.81801,"DJF":178.97,"DKK":6.275117,"DOP":47.278488,"DZD":113.454,"EGP":17.622,"ERN":15.333158,"ETB":23.45091,"EUR":0.842994,"FJD":2.051354,"FKP":0.75579,"GBP":0.75579,"GEL":2.478108,"GGP":0.75579,"GHS":4.395,"GIP":0.75579,"GMD":46.275,"GNF":8906.35,"GTQ":7.319909,"GYD":207.06,"HKD":7.80686,"HNL":23.331869,"HRK":6.330489,"HTG":63.080843,"HUF":260.717,"IDR":13502.802788,"ILS":3.4853,"IMP":0.75579,"INR":65.075,"IQD":1162.95,"IRR":33654.5,"ISK":104.74,"JEP":0.75579,"JMD":127.971482,"JOD":0.709001,"JPY":112.27,"KES":103.25,"KGS":68.399709,"KHR":4025.7,"KMF":415.25,"KPW":900,"KRW":1132.55,"KWD":0.301803,"KYD":0.830511,"KZT":333.96,"LAK":8315,"LBP":1502.9,"LKR":152.952819,"LRD":118.010556,"LSL":13.517836,"LYD":1.364414,"MAD":9.3903,"MDL":17.424728,"MGA":3046.65,"MKD":51.91,"MMK":1359.15,"MNT":2457.447826,"MOP":8.011891,"MRO":363.721657,"MUR":34.0005,"MVR":15.400126,"MWK":724.675734,"MXN":18.702241,"MYR":4.2195,"MZN":60.994761,"NAD":13.517351,"NGN":358.75,"NIO":30.207843,"NOK":7.9106,"NPR":103.905516,"NZD":1.404011,"OMR":0.385005,"PAB":1,"PEN":3.25875,"PGK":3.183202,"PHP":51.39,"PKR":104.782432,"PLN":3.600585,"PYG":5620.55,"QAR":3.729989,"RON":3.868701,"RSD":100.609575,"RUB":57.665,"RWF":830.479566,"SAR":3.750196,"SBD":7.810521,"SCR":13.541191,"SDG":6.653117,"SEK":8.092327,"SGD":1.353802,"SHP":0.75579,"SLL":7635.994028,"SOS":576.39,"SRD":7.448,"SSP":129.0194,"STD":20701.93181,"SVC":8.719665,"SYP":514.99499,"SZL":13.528287,"THB":33.105,"TJS":8.764406,"TMT":3.499986,"TND":2.463097,"TOP":2.247061,"TRY":3.637455,"TTD":6.70213,"TWD":30.197,"TZS":2245,"UAH":26.423235,"UGX":3617.4,"USD":1,"UYU":29.175341,"UZS":8032.8,"VEF":10.146563,"VND":22709.292617,"VUV":105.278798,"WST":2.531559,"XAF":552.967845,"XAG":0.05802155,"XAU":0.00077159,"XCD":2.70255,"XDR":0.707444,"XOF":552.967845,"XPD":0.0010379,"XPF":100.595948,"XPT":0.00106726,"YER":250.306642,"ZAR":13.460823,"ZMW":9.591214,"ZWL":322.355011}}
1+
{"disclaimer":"Usage subject to terms: https://openexchangerates.org/terms","license":"https://openexchangerates.org/license","timestamp":1508414400,"base":"USD","rates":{"AED":3.672973,"AFN":68.15,"ALL":112.92,"AMD":481.728804,"ANG":1.779789,"AOA":165.9225,"ARS":17.3379,"AUD":1.270644,"AWG":1.790246,"AZN":1.6985,"BAM":1.653896,"BBD":2,"BDT":82.537473,"BGN":1.653246,"BHD":0.377203,"BIF":1750,"BMD":1,"BND":1.357043,"BOB":6.909062,"BRL":3.167437,"BSD":1,"BTC":0.000175811708,"BTN":65.045224,"BWP":10.307664,"BYN":1.957114,"BZD":2.009704,"CAD":1.246334,"CDF":1570,"CHF":0.975172,"CLF":0.023185,"CLP":624.8,"CNH":6.619015,"CNY":6.6223,"COP":2923.75,"CRC":569.998642,"CUC":1,"CUP":25.5,"CVE":93.9,"CZK":21.7448,"DJF":178.77,"DKK":6.290249,"DOP":47.86869,"DZD":114.25,"EGP":17.6474,"ERN":15.191062,"ETB":26.984211,"EUR":0.844987,"FJD":2.046698,"FKP":0.758867,"GBP":0.758867,"GEL":2.482304,"GGP":0.758867,"GHS":4.405,"GIP":0.758867,"GMD":47.45,"GNF":9001,"GTQ":7.351488,"GYD":207.795851,"HKD":7.80255,"HNL":23.592243,"HRK":6.3449,"HTG":63.506926,"HUF":260.652005,"IDR":13513.746714,"ILS":3.496997,"IMP":0.758867,"INR":65.015,"IQD":1166.85,"IRR":34243.946723,"ISK":105.21,"JEP":0.758867,"JMD":127.415141,"JOD":0.7086,"JPY":112.49516667,"KES":103.585,"KGS":68.579481,"KHR":4035.5,"KMF":417.634177,"KPW":900,"KRW":1131.75,"KWD":0.302094,"KYD":0.833193,"KZT":334.519063,"LAK":8323.9,"LBP":1515.649713,"LKR":153.548466,"LRD":118.354791,"LSL":13.535513,"LYD":1.369746,"MAD":9.404986,"MDL":17.329616,"MGA":3082.1,"MKD":52.033759,"MMK":1367.3,"MNT":2454.299176,"MOP":8.035619,"MRO":355.495295,"MUR":33.95,"MVR":15.400167,"MWK":725.535,"MXN":18.804893,"MYR":4.222083,"MZN":61.115,"NAD":13.535527,"NGN":359.805566,"NIO":30.746369,"NOK":7.9722,"NPR":104.009834,"NZD":1.424587,"OMR":0.385015,"PAB":1,"PEN":3.236683,"PGK":3.201466,"PHP":51.406,"PKR":105.230492,"PLN":3.585395,"PYG":5639.3,"QAR":3.672571,"RON":3.883094,"RSD":100.656494,"RUB":57.54295,"RWF":854.182838,"SAR":3.7512,"SBD":7.777811,"SCR":13.768427,"SDG":6.675868,"SEK":8.160019,"SGD":1.35689,"SHP":0.758867,"SLL":7643.328121,"SOS":578.460064,"SRD":7.448,"SSP":130.2183,"STD":20769.150676,"SVC":8.748749,"SYP":514.98999,"SZL":13.533002,"THB":33.124,"TJS":8.799001,"TMT":3.499986,"TND":2.458496,"TOP":2.224732,"TRY":3.660214,"TTD":6.729148,"TWD":30.242233,"TZS":2244.6,"UAH":26.506511,"UGX":3656.55,"USD":1,"UYU":29.121233,"UZS":8057.7,"VEF":9.990025,"VND":22722.253308,"VUV":105.316668,"WST":2.533273,"XAF":554.275221,"XAG":0.05869414,"XAU":0.00077711,"XCD":2.70255,"XDR":0.70955,"XOF":554.275221,"XPD":0.0010424,"XPF":100.833786,"XPT":0.00108021,"YER":250.281642,"ZAR":13.539342,"ZMW":9.748924,"ZWL":322.355011}}

README.md

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

77
### Knowledgebase
8-
- [Challenge Terms - Mocking for Testing and Development](docs/challenge-terms.md)
8+
- [Mocking Terms for Testing and Development](docs/mocking-terms.md)
99
- [Code Splitting](docs/code-splitting.md)
1010
- [Coding Standards](docs/coding-standards.md)
1111
- [How to Add a New Topcoder Community?](docs/how-to-add-a-new-topcoder-community.md)

__tests__/shared/components/__snapshots__/Content.jsx.snap

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,22 @@ exports[`Matches shallow shapshot 1`] = `
343343
</Link>
344344
</li>
345345
</ul>
346+
<h3>
347+
Sandbox
348+
</h3>
349+
<p>
350+
The right place to put any experimental and proof-of-concept stuff.
351+
</p>
352+
<ul>
353+
<li>
354+
<Link
355+
replace={false}
356+
to="/sandbox/payments"
357+
>
358+
Payments PoC
359+
</Link>
360+
</li>
361+
</ul>
346362
<h3>
347363
Misc Examples
348364
</h3>

__tests__/shared/components/__snapshots__/Select.jsx.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ exports[`Matches shallow shapshot 1`] = `
2121
ignoreAccents={true}
2222
ignoreCase={true}
2323
inputProps={Object {}}
24-
instanceId="id"
2524
isLoading={false}
2625
joinValues={false}
2726
labelKey="label"

__tests__/shared/components/tc-communities/communities/community-2/__snapshots__/Home.jsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ exports[`Match shadow snapshot 1`] = `
1919
title="Community 2"
2020
/>
2121
<Connect(CommunityStatsContainer) />
22-
<Connect(JoinCommunity) />
22+
<Connect(JoinCommunityContainer) />
2323
<ThemedSection
2424
anchor={null}
2525
composeAdhocTheme="deeply"

__tests__/shared/components/tc-communities/communities/taskforce/__snapshots__/Home.jsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ exports[`Match shadow snapshot 1`] = `
3939
}
4040
}
4141
/>
42-
<Connect(JoinCommunity) />
42+
<Connect(JoinCommunityContainer) />
4343
<ThemedSection
4444
anchor="why-topcoder-taskforce"
4545
composeAdhocTheme="deeply"

__tests__/shared/containers/tc-communities/JoinCommunity.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { mount } from 'enzyme';
22
import React from 'react';
3+
import { Provider } from 'react-redux';
34
import configureStore from 'redux-mock-store';
45
import tActions from 'actions/tc-communities';
56
import JoinCommunity from 'components/tc-communities/JoinCommunity';
@@ -25,6 +26,7 @@ describe('full render connnected component and dispatch actions', () => {
2526
data: {
2627
challengeGroupId: '1',
2728
communityName: 'name',
29+
communityId: '1',
2830
},
2931
},
3032
hideJoinButton: true,
@@ -44,6 +46,9 @@ describe('full render connnected component and dispatch actions', () => {
4446
groups: {
4547
groups: {},
4648
},
49+
terms: {
50+
terms: [],
51+
},
4752
};
4853

4954
const mockStore = configureStore();
@@ -56,7 +61,7 @@ describe('full render connnected component and dispatch actions', () => {
5661
json: () => ({ result: { status: 200, metadata: {}, content: [] } }),
5762
});
5863
store = mockStore(initialState);
59-
instance = mount(<ConnectedJoinCommunity store={store} />);
64+
instance = mount(<Provider store={store}><ConnectedJoinCommunity /></Provider>);
6065
joinCommunity = instance.find(JoinCommunity);
6166
store.clearActions();
6267
});
@@ -74,7 +79,7 @@ describe('full render connnected component and dispatch actions', () => {
7479
},
7580
};
7681
store = mockStore(newStore);
77-
instance = mount(<ConnectedJoinCommunity store={store} />);
82+
instance = mount(<Provider store={store}><ConnectedJoinCommunity /></Provider>);
7883
});
7984

8085
test('hideJoinButton', () => {

config/custom-environment-variables.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
{
55
"LOG_ENTRIES_TOKEN": "LOG_ENTRIES_TOKEN",
6-
"MOCK_CHALLENGE_TERMS_SERVICE": "MOCK_CHALLENGE_TERMS_SERVICE"
6+
"MOCK_TERMS_SERVICE": "MOCK_TERMS_SERVICE"
77

88
}

config/default.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
* the setup. To override it use LOG_ENTRIES_TOKEN environment variable. */
3030
"LOG_ENTRIES_TOKEN": "816f5574-0d4a-49f9-ab3b-00d791f7c1f7",
3131

32-
/* When set to true, challenge terms service is short-cut so that each time
33-
* a user goes to challenge details page, it tells that none of challenge
32+
/* When set to true, terms service is short-cut so that each time
33+
* a user goes to challenge details page or community page, it tells that none of
3434
* terms is agrees, and takes care that user is taken through the terms
3535
* agreement flow. */
36-
"MOCK_CHALLENGE_TERMS_SERVICE": false,
36+
"MOCK_TERMS_SERVICE": false,
3737

3838
/* Configuration related to https://openexchangerates.org. This is the
3939
* service which provides currency exchange rates. */

config/webpack/default.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module.exports = {
2828
],
2929
loader: 'file-loader',
3030
options: {
31-
outputPath: '/fonts/',
31+
outputPath: '/community-app-fonts/',
3232
publicPath: '',
3333
},
3434
}, {

docs/challenge-terms.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

docs/how-to-add-a-new-topcoder-community.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ To add a new community with the name **demo**, we should follow the following pr
5252
],
5353
"newsFeed": "http://www.topcoder.com/feed",
5454
"description": "A berief description which will be displayed in dashboard",
55-
"image": "1.jpg"
55+
"image": "1.jpg",
56+
"terms": [21153]
5657
}
5758
```
5859
Its fields serve the following purposes:
@@ -116,6 +117,8 @@ To add a new community with the name **demo**, we should follow the following pr
116117
The `<NewsSection />` component does not render anything, if its `news` property is *null* or an empty array, thus it can be kept inside the page code even when there is no news feed configured for a community.
117118
- `description`: A berief description which will be displayed in dashboard.
118119
- `image`: A image that located at `/assets/images/tc-communities/background` will be displayed in dashboard
120+
- `terms` - *Array of Numbers* - Optional. If provided, it should hold an array of Topcoder term of use IDs; agreement to all these terms will be necessary to self-join the community. Beside this, it has no other effects at the moment.
121+
119122
3. Custom pages of the community (anything beside `Challenges` and `Leaderboard`) should be created inside `/src/shared/components/tc-communities/communities/demo`. At the moment all communities have two custom pages: `Home` and `Learn`, you may just copy these from an existing community, and then customize to your particular needs.
120123

121124
4. The routing inside community, and code splitting of the related code, should be set up inside `/src/shared/routes/Communities`:

docs/mocking-terms.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Mocking Terms for Testing and Development
2+
3+
Development and testing related to challenges and communities terms is not straightforward because in dev. environment related functionality does not work perfect, and in prod. it is not possible to reset agreement for a terms without admin privileges. Thus, we have a mock of terms service that helps to nail development, and also to write related unit-tests with Jest.
4+
5+
### Development
6+
7+
To enable terms mocking for development, run the app with `MOCK_TERMS_SERVICE` environment variable set to `true`. E.g., on Linux, in dev. mode against production backend, you execute `$ MOCK_TERMS_SERVICE=true NODE_ENV=production PORT=80 npm run dev`. Against development backend it would be simply `$ MOCK_TERMS_SERVICE=true npm run dev`.
8+
9+
With this option enabled, each challenge and community you access will be protected by two terms if user is not authenticated: a simple Topcoder ones + mock DocuSign NDA (really simple mock, renders a small HTML page, that shows buttons that, when pressed, imitate DocuSign callbacks in the cases of terms agreement or rejection). If a user is authenticated then each challenge and community will be protected by three terms one of which is agreed. By default, two terms won't be agreed initially. Agreeing with them won't be stored in the service mock though after all terms agreed `checkStatusDone` action will return all terms agreed. If you reload a page, you'll see that both terms are pending to be agreed with again.
10+
11+
The code of the mock module, and mock data for it, can be found in the `/src/shared/services/__mocks__` folder. You can modify them for your development and testing need, but, please, don't commit these changes to the repo, as we are planning to write unit-tests using this mock (if there is a really good reason to update the mock, be sure to check that related unit-tests are updated appropriately as well).
12+
13+
### Unit-Testing
14+
15+
Using this terms mock for unit-testing with Jest is straightforward: you add to an unit-test module `jest.mock('services/terms')`, and the module will be mocked using the same logic as for development.

0 commit comments

Comments
 (0)