Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Use submission API Wrapper #7

Merged
merged 1 commit into from
Sep 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ The following parameters can be set in config files or in env variables:
- REVIEW_TOPIC : Review topic, default value is 'submission.notification.score'
- CREATE_SUBMISSION_TOPIC : create submission topic, default value is 'submission.notification.create'
- UPDATE_SUBMISSION_TOPIC : update submission topic, default value is 'submission.notification.update'
- REVIEW_API_URL: review api url, default is 'https://api.topcoder-dev.com/v5/reviews'
- SUBMISSION_API_URL: submission api url, default is 'https://api.topcoder-dev.com/v5/submissions'
- REVIEW_TYPE_API_URL: review type api url, default is 'https://api.topcoder-dev.com/v5/reviewTypes'
- SUBMISSION_API_URL: submission api url, default is 'https://api.topcoder-dev.com/v5'
- CHALLENGE_API_URL: challenge API URL, default is 'https://api.topcoder-dev.com/v4/challenges'
- SCORECARD_API_URL: scorecard API URL, default is 'http://localhost:4000/scorecards'
- BUS_API_URL: bus API URL, default is 'https://api.topcoder-dev.com/v5/bus/events'
- AUTH0_URL: Auth0 URL, used to get TC M2M token
- AUTH0_AUDIENCE: Auth0 audience, used to get TC M2M token
- TOKEN_CACHE_TIME: Auth0 token cache time, used to get TC M2M token
Expand All @@ -38,7 +37,6 @@ Also note that there is a `/health` endpoint that checks for the health of the a

Configuration for the tests is at `config/test.js`, only add such new configurations different from `config/default.js`
- WAIT_TIME: wait time used in test, default is 2000 or 2 seconds
- REVIEW_SUMMATION_API_URL: review summation api url, used to clear resource during testing, default is 'https://api.topcoder-dev.com/v5/reviewSummations'

## Local Kafka setup

Expand Down
75 changes: 31 additions & 44 deletions Verification.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,51 +172,38 @@ debug: Successfully processed message

## Unit test Coverage

129 passing (51s)

--------------------------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
--------------------------------|----------|----------|----------|----------|-------------------|
All files | 89.89 | 78.46 | 98.31 | 90.22 | |
config | 100 | 97.22 | 100 | 100 | |
default.js | 100 | 100 | 100 | 100 | |
test.js | 100 | 75 | 100 | 100 | 6 |
src/common | 84.62 | 53.85 | 95 | 86.52 | |
helper.js | 69.23 | 50 | 85.71 | 75 | 18,91,92,93,95,96 |
logger.js | 90.77 | 55 | 100 | 90.77 |31,55,60,84,98,118 |
src/services | 89.32 | 78.85 | 100 | 89.11 | |
ReviewProcessorService.js | 94.74 | 85 | 100 | 94.59 | 66,67 |
SubmissionProcessorService.js | 86.15 | 75 | 100 | 85.94 |... 20,126,130,140 |
test/unit | 91.89 | 75 | 100 | 91.86 | |
review.processor.test.js | 91.87 | 70 | 100 | 91.8 |... 54,169,183,194 |
submission.processor.test.js | 91.91 | 83.33 | 100 | 91.91 |... 64,178,191,202 |
--------------------------------|----------|----------|----------|----------|-------------------|

129 passing (1s)

File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
--------------------------------|----------|----------|----------|----------|-------------------
All files | 91.63 | 79.63 | 100 | 91.46 |
config | 100 | 96.67 | 100 | 100 |
default.js | 100 | 100 | 100 | 100 |
test.js | 100 | 50 | 100 | 100 | 6
src/common | 92.13 | 57.69 | 100 | 91.95 |
helper.js | 95.83 | 66.67 | 100 | 95.45 | 18
logger.js | 90.77 | 55 | 100 | 90.77 |31,55,60,84,98,118
src/services | 91.07 | 80.77 | 100 | 90.91 |
ReviewProcessorService.js | 97.87 | 90 | 100 | 97.83 | 72
SubmissionProcessorService.js | 86.15 | 75 | 100 | 85.94 |... 20,126,130,140


## E2E test Coverage

136 passing (6m)

--------------------------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
--------------------------------|----------|----------|----------|----------|-------------------|
All files | 94.82 | 79.33 | 96.2 | 95.11 | |
config | 100 | 97.22 | 100 | 100 | |
default.js | 100 | 100 | 100 | 100 | |
test.js | 100 | 75 | 100 | 100 | 6 |
src | 93.88 | 71.43 | 90 | 93.75 | |
app.js | 93.75 | 71.43 | 90 | 93.62 | 49,61,86 |
bootstrap.js | 100 | 100 | 100 | 100 | |
src/common | 84.62 | 61.54 | 95 | 86.52 | |
helper.js | 69.23 | 50 | 85.71 | 75 | 18,91,92,93,95,96 |
logger.js | 90.77 | 65 | 100 | 90.77 |31,55,60,84,98,118 |
src/services | 89.32 | 78.85 | 100 | 89.11 | |
ReviewProcessorService.js | 94.74 | 85 | 100 | 94.59 | 66,67 |
SubmissionProcessorService.js | 86.15 | 75 | 100 | 85.94 |... 20,126,130,140 |
test/e2e | 99.4 | 77.27 | 97.62 | 99.4 | |
review.processor.test.js | 99.27 | 75 | 100 | 99.26 | 32 |
submission.processor.test.js | 99.49 | 80 | 95.83 | 99.49 | 49 |
--------------------------------|----------|----------|----------|----------|-------------------|


136 passing (5m)

File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
--------------------------------|----------|----------|----------|----------|-------------------
All files | 92.06 | 80.33 | 97.14 | 91.9 |
config | 100 | 96.67 | 100 | 100 |
default.js | 100 | 100 | 100 | 100 |
test.js | 100 | 50 | 100 | 100 | 6
src | 93.88 | 71.43 | 90 | 93.75 |
app.js | 93.75 | 71.43 | 90 | 93.62 | 49,61,86
bootstrap.js | 100 | 100 | 100 | 100 |
src/common | 92.13 | 65.38 | 100 | 91.95 |
helper.js | 95.83 | 66.67 | 100 | 95.45 | 18
logger.js | 90.77 | 65 | 100 | 90.77 |31,55,60,84,98,118
src/services | 91.07 | 80.77 | 100 | 90.91 |
ReviewProcessorService.js | 97.87 | 90 | 100 | 97.83 | 72
SubmissionProcessorService.js | 86.15 | 75 | 100 | 85.94 |... 20,126,130,140
5 changes: 2 additions & 3 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ module.exports = {
// Kafka topic related to update submission
UPDATE_SUBMISSION_TOPIC: process.env.UPDATE_SUBMISSION_TOPIC || 'submission.notification.update',

REVIEW_API_URL: process.env.REVIEW_API_URL || 'https://api.topcoder-dev.com/v5/reviews',
SUBMISSION_API_URL: process.env.SUBMISSION_API_URL || 'https://api.topcoder-dev.com/v5/submissions',
REVIEW_TYPE_API_URL: process.env.REVIEW_TYPE_API_URL || 'https://api.topcoder-dev.com/v5/reviewTypes',
SUBMISSION_API_URL: process.env.SUBMISSION_API_URL || 'https://api.topcoder-dev.com/v5',

CHALLENGE_API_URL: process.env.CHALLENGE_API_URL || 'https://api.topcoder-dev.com/v4/challenges',
SCORECARD_API_URL: process.env.SCORECARD_API_URL || 'http://localhost:4000/scorecards',
BUS_API_URL: process.env.BUS_API_URL || 'https://api.topcoder-dev.com/v5/bus/events',
Expand Down
4 changes: 1 addition & 3 deletions config/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@
*/

module.exports = {
WAIT_TIME: process.env.WAIT_TIME ? Number(process.env.WAIT_TIME) : 2000,
REVIEW_SUMMATION_API_URL: process.env.REVIEW_SUMMATION_API_URL ||
'https://api.topcoder-dev.com/v5/reviewSummations'
WAIT_TIME: process.env.WAIT_TIME ? Number(process.env.WAIT_TIME) : 2000
}
2 changes: 1 addition & 1 deletion mock-scorecard-api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ scoreSystems.forEach(element => {
app.get('/scoreSystems', (req, res) => res.json(scoreSystems))
app.get('/scorecards/:id', (req, res) => res.json(scorecardDetails))

app.listen(process.env.PORT || 4000);
app.listen(process.env.PORT || 4000)
console.log(`Server listening on http://localhost:${process.env.PORT || 4000}`)
Loading