Test your module

Before testing, make sure you have these commands in your package.json:

package.json
{
  ...
  "scripts": {
    "local": "marjory local",
    "action": "marjory action",
    "package": "marjory package"
  },
  ...
}

Commands

action

To test a single action within the command line, you can run the action command with the name of the action, the data you need for it, and if you use the Store, you can pass in a store object to test your action.

Before launching this command, you need to create a credentials.json file with at least an empty object. You can pass your credentials if needed in this file without the need to specify it in the command.

yarn action \
    -n actionName \
    -d /path/to/dataExample.json
    -s /path/to/storeExample.json

local

To launch your module in development mode on http://localhost:3000:

yarn local # Port 3000 by default

You can now launch your favorite API test tools or simply use CURL to test your functions:

curl \
    -d '{ "data": { "id": "1234" }, "credentials": {}, "store": {} }' \
    -H "Content-Type: application/json" \
    -X \
    POST http://localhost:3000/actions/actionName

Last updated