Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ampme/parse-server-test-runner

A tool for programmatically starting Parse Server
https://github.com/ampme/parse-server-test-runner

jasmine mocha parse parse-server

Last synced: 3 months ago
JSON representation

A tool for programmatically starting Parse Server

Awesome Lists containing this project

README

        

# Parse Server Test Runner

[![npm version](https://img.shields.io/npm/v/parse-server-test-runner.svg?style=flat)](https://www.npmjs.com/package/parse-server-test-runner)

This library allows [Parse Server](https://github.com/parse-community/parse-server) to be set up programmatically for testing purposes.

## Example
This is an example of a Jasmine spec using `parse-server-test-runner`.
The timeout is set to 2 minutes because downloading MongoDB might take a few minutes.

```javascript
const { startParseServer, stopParseServer, dropDB } = require('parse-server-test-runner');

// ...
describe('my spec', () => {
beforeAll((done) => {
const appId = 'test';
const masterKey = 'test';
const javascriptKey = 'test';

startParseServer({ appId, masterKey, javascriptKey })
.then(() => {
Parse.initialize(appId, masterKey, javascriptKey);
Parse.serverURL = 'http://localhost:30001/1';
})
.then(done).catch(done.fail);
}, 100 * 60 * 2);

afterAll((done) => {
stopParseServer()
.then(done).catch(done.fail);
});

beforeEach((done) => {
dropDB()
.then(done).catch(done.fail);
});

it('should work', (done) => {
const q = new Parse.Query('_Installation')
q.limit(5)
.find({ useMasterKey: true })
.then(console.log)
.then(done).catch(done.fail);
});
});
```