Skip to content

Cloud jobs #86

@coderofsalvation

Description

@coderofsalvation

I didn't really find a way to call cloud jobs using this lib:

(node:9393) UnhandledPromiseRejectionWarning: TypeError: Parse.Cloud.job is not a function

This is my temporary solution by just adding this file mock.CloudJob.js somewhere:

module.exports = function(Parse){
    Parse.Cloud = {
        jobs:{},
        define: function(){},
        job: function(k,f){
            Parse.Cloud.jobs[k] = f
        },
        startJob: function(k,v){
            return Parse.Cloud.jobs[k](v)
        }
    }
}

Now in your code you can do require('mock.CloudJob')(Parse) and register & start Cloud-jobs as usual.

NOTE: I know this hack doesn't really follow the narrative of this lib, therefore I just figured to post this here (instead of doing a PR which doesn't really fit this lib). It might be useful to someone, or could start a brainstorm for Cloud-jobs in parse-mockdb.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions