Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: In-Memory Storage adapter for mocking unit tests #5437

Closed
mrmarcsmith opened this issue Mar 20, 2019 · 2 comments
Closed

Request: In-Memory Storage adapter for mocking unit tests #5437

mrmarcsmith opened this issue Mar 20, 2019 · 2 comments
Labels
type:feature New feature or improvement of existing feature

Comments

@mrmarcsmith
Copy link
Contributor

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is.

I'm bummed there isn't a "baked in" method for efficient unit testing without mongo.

Describe the solution you'd like
A clear and concise description of what you want to happen.

I'm imagining an "In-Memory" storage adapter that contains ALL of the functionality of parse without any of the unit-testing "baggage" of mongo. For example, I could "save" an object, then query for the object but the "object" is stored in RAM instead of Mongo.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Our current options for testing are:

  1. test the javascript function manually -> doesn't mock Parse objects or any other "more complex" parse server functionality
    example from @flovilmart
// lib/jobs.js

module.exports = {
   job_1: function() {},
   job_2: function() {} 
}
...

// main.js

var jobs = require('lib/jobs');
Object.keys(jobs).forEach(function(jobName) {
   Parse.Cloud.job(jobName, jobs[jobName]);
});
  1. spin up parse server with mongo-runner -> requires additional resources and slows tests down.

  2. I'm open to additional suggestions if anyone has any!

Additional context
Add any other context or screenshots about the feature request here.

@mrmarcsmith mrmarcsmith changed the title In-Memory Storage adapter for mocking tests In-Memory Storage adapter for mocking unit tests Mar 20, 2019
@mrmarcsmith mrmarcsmith changed the title In-Memory Storage adapter for mocking unit tests Feature Req: In-Memory Storage adapter for mocking unit tests Mar 20, 2019
@mrmarcsmith mrmarcsmith changed the title Feature Req: In-Memory Storage adapter for mocking unit tests Request: In-Memory Storage adapter for mocking unit tests Mar 20, 2019
@acinader
Copy link
Contributor

acinader commented Apr 2, 2019

I've used and contributed to some 'fake mongos' for unit testing, but I've since switched over to using mongodb-runner instead as it is fast and easy.

the unit testing setup for parse-server is pretty messy, but if you look at how it is setup for the integration Parse-SDK-JS, it's pretty straight forward: https://github.com/parse-community/Parse-SDK-JS/tree/master/integration

is that helpful?

@TomWFox TomWFox added the type:feature New feature or improvement of existing feature label May 5, 2019
@stale
Copy link

stale bot commented Jun 19, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or improvement of existing feature
Projects
None yet
Development

No branches or pull requests

3 participants