# express-test-util

> test utils for express middlewares

Latest version **1.1.5** (published 2016-11-15) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install express-test-util
pnpm add express-test-util
yarn add express-test-util
bun add express-test-util
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.5 |
| Published | 2016-11-15 |
| First published | 2016-11-15 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | wangshijun |
| Maintainers | wangshijun |
| Keywords | express, test, util |

## Links

- npm: https://www.npmjs.com/package/express-test-util
- Repository: https://github.com/renrenche/express-test-util
- Issues: https://github.com/renrenche/express-test-util/issues
- npm.io page: https://npm.io/package/express-test-util

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 1.1.5 (latest) — 2016-11-15

## README

# express-test-util
> test utils for express middlewares (which must call next)

## Installation

```sh
$ npm install --save express-test-util
```

## Usage

```js
const config = require('config');
const expect = require('chai').expect;
const util = require('express-test-util');

const middleware = function (req, res, next) {
    res.cookie('key', 'value');
    next();
};

describe('#default', function () {
    it('should use req.param.city when exists', function (done) {
        const req = util.mockRequest({ params: { city: 'bj' }, props: { cityList } });
        const res = util.mockResponse();

        middleware(req, res, function (err) {
            if (err) {
                return done(err);
            }

            expect(req.param('city')).to.equal('bj');
            expect(res.cookies.key).to.deep.equal({ value: 'bj', options: {} });
            done();
        });
    });

});
```
## License

Apache-2.0 © [wangshijun](wangshijun@renrenche.com)

---
_Source: https://npm.io/package/express-test-util · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
