Skip to content

Commit ec68f50

Browse files
committed
Merge pull request #226 from ParsePlatform/integration_tests
Integration tests (Rye)
2 parents f6ec683 + 73803d9 commit ec68f50

20 files changed

+5491
-1
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: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
---
22
language: node_js
33
node_js:
4-
- 'iojs'
4+
- '5'
55

66
branches:
77
only:
88
- master
99

10+
env:
11+
- CXX=g++-4.8
12+
13+
services: mongodb
14+
15+
addons:
16+
apt:
17+
sources:
18+
- mongodb-3.0-precise
19+
- ubuntu-toolchain-r-test
20+
packages:
21+
- mongodb-org-server
22+
- g++-4.8
23+
24+
script: npm test && ./run_integration.sh
1025
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)