# joi-jasmine-helpers

> Custom matchers for writing unit test for joi schemas and extensions

Latest version **0.1.1** (published 2017-08-14) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install joi-jasmine-helpers
pnpm add joi-jasmine-helpers
yarn add joi-jasmine-helpers
bun add joi-jasmine-helpers
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2017-08-14 |
| First published | 2017-08-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Tom Tepez Yam |
| Maintainers | tomyam1 |
| Keywords | joi, extensions, jasmine, test |

## Links

- npm: https://www.npmjs.com/package/joi-jasmine-helpers
- Repository: https://github.com/tepez/joi-jasmine-helpers
- Homepage: https://github.com/tepez/joi-jasmine-helpers#readme
- Issues: https://github.com/tepez/joi-jasmine-helpers/issues
- npm.io page: https://npm.io/package/joi-jasmine-helpers

## Dependencies (1)

- [lodash.isregexp](https://npm.io/package/lodash.isregexp.md) ^4.0.1

## 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

- 0.1.1 (latest) — 2017-08-14
- 0.1.0 — 2017-08-14

## README

# joi-jasmine-helpers
> Custom matchers for writing unit test for [joi](https://github.com/hapijs/joi) schemas and extensions

[![npm version](https://badge.fury.io/js/joi-jasmine-helpers.svg)](http://badge.fury.io/js/joi-jasmine-helpers)
[![Build Status](https://secure.travis-ci.org/tepez/joi-jasmine-helpers.svg?branch=master)](http://travis-ci.org/tepez/joi-jasmine-helpers)

## Usage


```js
const Joi = require('joi');
const JoiJasmineHelpers = require('..');


beforeEach(() => {
   JoiJasmineHelpers.addMatchers();
});

const schema = Joi.number().integer();

it('toPassValidation', () => {
    expect(schema).toPassValidation(100);
    expect(schema).toPassValidation('100');

    expect(schema).toPassValidation(100, 100);
    expect(schema).toPassValidation('100', 100);

    expect(schema).toPassValidation(100, 100, { convert: true });
});

it('toFailValidation', () => {
    expect(schema).toFailValidation('xxx');
    expect(schema).toFailValidation('xxx', '"value" must be a number');
    expect(schema).toFailValidation('xxx', /^"value" must be a number$/);
    expect(schema).toFailValidation(10.5, /^"value" must be an integer$/);

    expect(schema).toFailValidation('100', '"value" must be a number', { convert: false });
});
```

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