Skip to content

Commit 5f4109e

Browse files
committed
Added default config values to use for tests.
Fixed issue where integration tests cannot be run whilst API is running.
1 parent fa9ea3d commit 5f4109e

File tree

6 files changed

+14
-4
lines changed

6 files changed

+14
-4
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ Config Setting | Description | Default Value
137137
`status.allowNewSyncs` | Determines whether users will be allowed to create new syncs on this server. Note: if this setting is set to false, users who have already synced to this service and have a sync ID will still able to get and update their syncs. | `true`
138138
`status.message` | This message will be displayed in the service status panel of the client app when using this xBrowserSync service. Ideally the message should be 130 characters or less. | (Empty string, no message set)
139139
`status.online` | If set to true no clients will be able to connect to this service. | `true`
140+
`tests.db` | Name of the mongoDB database to use for integration tests. | `xbrowsersynctest`
141+
`tests.port` | Port to use for running tests. | `8081`
140142
`throttle.maxRequests` | Max number of connections during `throttle.timeWindow` milliseconds before sending a 429 response. Set as `0` to disable. | `1000`
141143
`throttle.timeWindow` | Amount of time (in milliseconds) before throttle counter is reset. | `300000` (5 mins)
142144

config/settings.default.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
"message": "",
3333
"online": true
3434
},
35+
"tests": {
36+
"db": "xbrowsersynctest",
37+
"port": 8081
38+
},
3539
"throttle": {
3640
"maxRequests": 1000,
3741
"timeWindow": 300000

test/integration/bookmarks.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ describe('BookmarksRouter', () => {
3434
...require('../../config/settings.default.json'),
3535
version
3636
};
37-
testConfig.db.name = `${testConfig.db.name}test`;
37+
testConfig.db.name = testConfig.tests.db;
3838
testConfig.log.enabled = false;
39+
testConfig.server.port = testConfig.tests.port;
3940
sandbox = sinon.createSandbox();
4041
sandbox.stub(Config, 'get').returns(testConfig);
4142

test/integration/docs.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ describe('Docs', () => {
2222
...require('../../config/settings.default.json'),
2323
version
2424
};
25-
testConfig.db.name = `${testConfig.db.name}test`;
25+
testConfig.db.name = testConfig.tests.db;
2626
testConfig.log.enabled = false;
27+
testConfig.server.port = testConfig.tests.port;
2728
sandbox = sinon.createSandbox();
2829
sandbox.stub(Config, 'get').returns(testConfig);
2930

test/integration/info.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ describe('InfoRouter', () => {
2222
...require('../../config/settings.default.json'),
2323
version
2424
};
25-
testConfig.db.name = `${testConfig.db.name}test`;
25+
testConfig.db.name = testConfig.tests.db;
2626
testConfig.log.enabled = false;
27+
testConfig.server.port = testConfig.tests.port;
2728
sandbox = sinon.createSandbox();
2829
sandbox.stub(Config, 'get').returns(testConfig);
2930

test/integration/server.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ describe('Server', () => {
3434
...require('../../config/settings.default.json'),
3535
version
3636
};
37-
testConfig.db.name = `${testConfig.db.name}test`;
37+
testConfig.db.name = testConfig.tests.db;
3838
testConfig.log.enabled = false;
39+
testConfig.server.port = testConfig.tests.port;
3940
sandbox = sinon.createSandbox();
4041
sandbox.stub(Config, 'get').returns(testConfig);
4142

0 commit comments

Comments
 (0)