# freebees

> API testing made easy

Latest version **0.0.2** (published 2018-07-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install freebees
pnpm add freebees
yarn add freebees
bun add freebees
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2018-07-27 |
| First published | 2017-12-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 13.5 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Laurent Margirier |
| Maintainers | marg51 |

## Links

- npm: https://www.npmjs.com/package/freebees
- Repository: https://github.com/marg51/freebees
- npm.io page: https://npm.io/package/freebees

## Dependencies (5)

- [lodash](https://npm.io/package/lodash.md) ^4.17.10
- [request](https://npm.io/package/request.md) ^2.87.0
- [cli-table](https://npm.io/package/cli-table.md) ^0.3.1
- [jsonschema](https://npm.io/package/jsonschema.md) ^1.2.4
- [prettyjson](https://npm.io/package/prettyjson.md) ^1.2.1

## Recent versions

- 0.0.2 (latest) — 2018-07-27
- 0.0.1 — 2017-12-23

## README

# Free bees :bee:

Inspired by http://frisbyjs.com/, using jest and https://github.com/request/request

```bash
npm install freebees
```

<img width="471" alt="screen shot 2017-06-27 at 12 20 50" src="https://user-images.githubusercontent.com/543507/27585472-52f7cc02-5b34-11e7-8573-b7456030ba33.png">

```javascript
Freebees
    // see https://github.com/request/request
    .get({
        url: "https://jsonplaceholder.typicode.com/comments",
        json: true,
    })
    .expectStatus(200)
    .expectMaxResponseTime(500)
    .expectMaxDownloadTime(1500)
    .expectMaxEndTime(2000) // end time = response + download
    .expectJSONMatchesObject({ id: 1 }, "0") // get first item, can be a path (ie. users.0.name )
    .expectBodyContains("Eliseo@gardner.biz")
    .expectBodyContains(/@sydney.com/)
    .expectBodyToMatchSnapshot()
    .it("expect body should have length 500", ({ body }) => {
        return expect(body.length).toBe(500)
    })
```

### getting started

```bash
npm install --save freebees jest
```

update your `package.json`'s _scripts.test_ value to `jest`:

```json
{
    "scripts": {
        "test": "jest"
    }
}
```

create a new file `http.test.js`

```js
var freebees = require("freebees")
const http = freebees.default.http

// or

import { http } from "freebees"

http
    .get({
        url: "https://jsonplaceholder.typicode.com/posts/1",
        json: true,
    })
    .expectHeader("x-powered-by")
    .expectHeaderContains("content-type", "application/json")
    .expectJSONContains("userId")
    .expectJSONMatchesObject({ id: 1 })
```

`npm t` to run the tests

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