Skip to content

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

License

Notifications You must be signed in to change notification settings

jcbsfilho/example-node-red-helper-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published