<commit_before># node-fetch-response-matchers

[![Build Status](https://travis-ci.org/kfiron/node-fetch-response-matchers.svg?branch=master)](https://travis-ci.org/kfiron/node-fetch-response-matchers)

Matchers for node-fetch promise response.
It helps the tests to be more declarative.

## Install (for dev only - used by tests)
```shell
$ npm i node-fetch-response-matchers --save-dev
```

## Usage example
```javascript

const nodeFetchMatchers = require('node-fetch-response-matchers');
const nodeFetch = require('node-fetch');
const chai = require('chai');

chai.use(nodeFetchMatchers);
<commit_msg>test readme<commit_after># node-fetch-response-matchers

[![Build Status](https://travis-ci.org/kfiron/node-fetch-response-matchers.svg?branch=master)](https://travis-ci.org/kfiron/node-fetch-response-matchers)

Matchers for node-fetch promise response.
It helps the tests to be more declarative.

## TL;DR

- Verbose way to test node-fetch response:
```javascript
   it('some-test', function(done){
      nodeFetch('http://localhost/')
         .then(res => {
            expect(res.status).to.equal(200);
            return text();
         }).then(text => {
            expect(text).to.equal('foo');
         })
   });
```

- Using this lib:
```javascript
   it('some-test', function(){
     return nodeFetch('http://localhost/').to.be.successful()
                            .and.haveBodyText('foo');

   });
```



## Install (for dev only - used by tests)
```shell
$ npm i node-fetch-response-matchers --save-dev
```

## Usage example
```javascript

const nodeFetchMatchers = require('node-fetch-response-matchers');
const nodeFetch = require('node-fetch');
const chai = require('chai');

chai.use(nodeFetchMatchers);

{'fraction_non_alphanumeric': 0.16541353383458646, 'fraction_numerical': 0.001735106998264893, 'mean_word_length': 3.6883468834688347, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2416752', 'n_tokens_mistral': 560, 'n_tokens_neox': 543, 'n_words': 111}