Skip to content

Latest commit

 

History

History
70 lines (47 loc) · 1.48 KB

README.md

File metadata and controls

70 lines (47 loc) · 1.48 KB

Example Node-red Helper Test

This is the example of Node-red unit and integration tests, based on the module node-red-node-test-helper.

This example was made based on the node-red-node-test-helper module and there is a fork for the github module:jcbsfilho/node-red-node-test-helper and made a change to expose httpin in routes.

Link to module node-red-node-test-helper.

Dependencies package.json file:

...

  "devDependencies": {
    "node-red-node-test-helper": "github:jcbsfilho/node-red-node-test-helper",
    "mocha": "^9.0.0",
    "node-red": "^1.3.5"
  }
...

Unit Test

  npm run test-unit

Integration Test

  npm run test-integration

All Test

  npm run test

Results

> mocha "./test/**/*.spec.js"

  HTTP in Test Integration
    POST /users
      ✓ missing payload in request expect 400 bad request (97ms)
      ✓ success creating the user 201 create

  Function Unit Test
    Function Name req entry
      ✓ required fields when invalid
      ✓ required fields when valid
    Function Name check email
      ✓ check if the email is invalid
      ✓ check if the email is valid


  6 passing (369ms)

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.

License

MIT