@panda-clouds/parse-runner

Spins up dockerized Parse Server and Mongo instances for testing

Usage no npm install needed!

<script type="module">
  import pandaCloudsParseRunner from 'https://cdn.skypack.dev/@panda-clouds/parse-runner';
</script>

README

PCParseRunner

maintained by PandaClouds.com

PCParseRunner spins up dockerized "Parse Server" and "Mongo" instances for testing.

Installation

  1. If you want to use this library, you first need to install the Node.js.

  2. When you install node.js, will also be installed npm.

  3. Please run the following command.

npm install --save-dev @panda-clouds/parse-runner

Usage

Node.js

const PCParseRunner = require('@panda-clouds/parse-runner');
let Parse;

describe('a describe block', () => {

    const parseRunner = new PCParseRunner();

    parseRunner.parseVersion(version);

    // begin optional cloud code
    const cloud =
`
Parse.Cloud.define('myFunction', function(request, response) {
    return 'myResults';
});
`;
    parseRunner.cloud(cloud);
    // end optional cloud code

    beforeAll(async () => {
        Parse = await parseRunner.startParseServer();
    }, 1000 * 60 * 2);

    afterAll(async () => {
        await parseRunner.cleanUp();
    });

    it('should call a Parse function', async () => {
        const result = await Parse.Cloud.run('myFunction');

        expect(result).toBe('myResults');
        expect(result).not.toBe('superman');
    });
})

You can replace PCParseRunner with any variable.

Methods

Unit Tests are the best resource for learning functionality.

Contributions

Pull requests are welcome! here is a checklist to speed things up:

  • modify PCParseRunner.js
  • add unit tests in PCParseRunner.spec.js
  • run npm test
  • document method in README.md
  • add your name to 'Contributors' in README.md

Contributors

(Add your name)