1.1.6 • Published 1 year ago

express-test-utils v1.1.6

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

express-test-utils

Node Build

  • Package for random express utility testing functions that I use regularly
  • Documentation can be found here

Installation

npm install express-test-utils

Setup

  • For versions 1.1.0 and above, you may encounter issues with Jest complaining about expect requiring just one argument. This occurs since my package relies on jest-expect-message to provide expect messages. To fix this, follow steps in Setup on jest-expect-message's readme. Which pretty much replaces the expect definition for your project

Usage

const testUtils = require("express-test-utils");

testUtils.testValidationChain(args);

// Or whatever else you wish to do

Functions

  • See documentation linked above for full details

  • testRequiredBodyValues(paths, body, chain) tests whether given body values are required by a validation chain

  • checkForValidationErrors(req, chain, shouldBeNoErrors) checks for any validation errors against whether a request should pass a chain or not
  • checkRequestAuthentication(req, auth) checks if a request passes authentication with given function or not
  • checkForValidationErrors(req, res, chain) checks for any express-validator validation errors for running the given request through the given chain

Contributing

  • If you would like to leave feedback or suggestions, please refer to our issues page.
  • PRs are welcome
1.1.1

1 year ago

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.1.6

1 year ago

1.0.7

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago