Skip to content

Commit 2758a0b

Browse files
committed
Integration tests (Rye)
1 parent f6ec683 commit 2758a0b

20 files changed

+5476
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
coverage
22
dist
33
lib
4+
logs
45
node_modules
56
test_output
67
*~

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ branches:
77
only:
88
- master
99

10+
services: mongodb
11+
12+
script: npm test && ./run_integration.sh
1013
after_script: cat ./coverage/coverage-final.json | ./node_modules/codecov.io/bin/codecov.io.js && rm -rf ./coverage

integration/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Integration tests
2+
3+
These tests run against a local instance of `parse-server`

integration/package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"private": true,
3+
"dependencies": {
4+
"express": "^4.13.4",
5+
"mocha": "^2.4.5",
6+
"parse-server": "^2.1.1"
7+
},
8+
"scripts": {
9+
"test": "mocha --reporter dot -t 5000"
10+
}
11+
}

integration/server.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
var express = require('express');
2+
var ParseServer = require('parse-server').ParseServer;
3+
var app = express();
4+
5+
// Specify the connection string for your mongodb database
6+
// and the location to your Parse cloud code
7+
var api = new ParseServer({
8+
databaseURI: 'mongodb://localhost:27017/integration',
9+
appId: 'integration',
10+
masterKey: 'notsosecret',
11+
serverURL: 'http://localhost:1337/parse' // Don't forget to change to https if needed
12+
});
13+
14+
// Serve the Parse API on the /parse URL prefix
15+
app.use('/parse', api);
16+
17+
const DatabaseAdapter = require('parse-server/lib/DatabaseAdapter');
18+
19+
app.get('/clear', (req, res) => {
20+
var promises = [];
21+
for (var conn in DatabaseAdapter.dbConnections) {
22+
promises.push(DatabaseAdapter.dbConnections[conn].deleteEverything());
23+
}
24+
Promise.all(promises).then(() => {
25+
res.send('{}');
26+
});
27+
});
28+
29+
app.listen(1337, () => {
30+
console.log('parse-server running on port 1337.');
31+
});

0 commit comments

Comments
 (0)