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

Commit f50cc85

Browse files
committed
Unit tests for Gitlab
1 parent 582218e commit f50cc85

File tree

7 files changed

+1121
-3
lines changed

7 files changed

+1121
-3
lines changed

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"env": {
3-
"node": true
3+
"node": true,
4+
"mocha": true
45
},
56
"parserOptions": {
67
"ecmaVersion": 8,

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ For using with SSL, the options should be as
5757
}
5858
```
5959

60+
The following config paramaters are supported in the test environment defined in `config/test.js` and can be configured in the system environment. Note that the test config inherits all config options present in the default config and adds/overrides some config options.
61+
62+
| Name | Description | Default |
63+
| :----------------------------- | :----------------------------------------: | :------------------------------: |
64+
| GITLAB_REPO_URL | the url of the gitlab repo to run tests in | |
65+
| TC_URL | the topcoder development url | https://www.topcoder-dev.com |
66+
| TC_DEV_API_URL | the topcoder development api url | https://api.topcoder-dev.com/v3|
67+
| WAIT_TIME | the amount of time in milliseconds to wait for updates on gitlab to propagate to topcoder challenges. Some tests use multipliers of this value | 60000 |
68+
69+
6070
## Local Deployment
6171

6272
```shell
@@ -76,6 +86,10 @@ Go to Topcoder X UI login with above used topcoder username and
7686

7787
Now, receiver service can receive the webhooks from git host's project and processor can processes the requests. Now you can verify this service by following the verification steps below
7888

89+
## Run tests
90+
```
91+
npm test
92+
```
7993
## Verification
8094

8195
- create an issue in the repo, you can see the logs in `receiver` and `processor`, the `issue.created` event is generated.

config/test.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright (c) 2017 TopCoder, Inc. All rights reserved.
3+
*/
4+
'use strict';
5+
/**
6+
* This module is the test configuration of the app.
7+
* @author TCSCODER
8+
* @version 1.1
9+
*/
10+
/* eslint-disable */
11+
const defaultConfig = require('./default');
12+
13+
const testConfig = {
14+
GITLAB_REPO_URL: process.env.GITLAB_REPO_URL || '',
15+
TC_URL: process.env.TC_URL || 'https://www.topcoder-dev.com',
16+
TC_DEV_API_URL: process.env.TC_DEV_API_URL || 'https://api.topcoder-dev.com/v3',
17+
WAIT_TIME: process.env.WAIT_TIME || 60000
18+
};
19+
20+
module.exports = Object.assign(defaultConfig, testConfig);

configuration.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ For using with SSL, the options should be as
4141
}
4242
}
4343
```
44+
45+
The following config paramaters are supported in the test environment defined in `config/test.js` and can be configured in the system environment. Note that the test config inherits all config options present in the default config and adds/overrides some config options.
46+
47+
| Name | Description | Default |
48+
| :----------------------------- | :----------------------------------------: | :------------------------------: |
49+
| GITLAB_REPO_URL | the url of the gitlab repo to run tests in | |
50+
| TC_URL | the topcoder development url | https://www.topcoder-dev.com |
51+
| TC_DEV_API_URL | the topcoder development api url | https://api.topcoder-dev.com/v3|
52+
| WAIT_TIME | the amount of time in milliseconds to wait for updates on gitlab to propagate to topcoder challenges. Some tests use multipliers of this value | 60000 |
53+
4454
## Github Verification
4555

4656
#### Webhook configuration

0 commit comments

Comments
 (0)