# skorice

> Skorice is an object structure assertion library.

Latest version **1.1.3** (published 2017-03-17) · MIT license · 0 weekly downloads

## Install

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

## 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.3 |
| Published | 2017-03-17 |
| First published | 2017-03-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Antonin Januska |
| Maintainers | antjanus |

## Links

- npm: https://www.npmjs.com/package/skorice
- Repository: https://github.com/asteridux/skorice
- Homepage: https://github.com/asteridux/skorice#readme
- Issues: https://github.com/asteridux/skorice/issues
- npm.io page: https://npm.io/package/skorice

## Dependencies (2)

- [deep-eql](https://npm.io/package/deep-eql.md) 2.0.1
- [type-detect](https://npm.io/package/type-detect.md) 4.0.0

## Recent versions

- 1.1.3 (latest) — 2017-03-17
- 1.1.2 — 2017-03-17
- 1.1.1 — 2017-03-17

## README

# SkoriceJS

The spice you sprinkle on top of your ChaiJS assertion library and your MochaJS test runner.

Skorice is an object structure assertion library. The same way you can assert values like true/false or 1/2/3/4 or whatever else, you can now assert that an object has the structure you expect.

## Installation

```bash
npm install skorice --save-dev
```

and import/require it in your test file to use:

```js
import skorice from 'skorice';
```

## Basic Usage

Let's say you have an API that you're testing. For integration (or "end to end") testing of APIs, you can hit up the API with the likes of `supertest` (a wrapper for `superagent`) and test the response.

### assertLike

The test asserts that the body is `like` the template, meaning that the body has AT LEAST the keys that template has.

```js
agent
  .get('/api/tweets')
  .expect(200)
  .expect((res) => {
    var body = res.body;

    var template = {
      id: '',
      name: '',
      body: ''
    };

    skorice.assertLike(template, body);
  })
```


### assertExact

You can also check for exact structure:

```js
skorice.assertExact(template, body);
```

It'll make sure that whatever you pass in as a template, the body will have no matter how deep either structure is.

### assertEqual

A basic "equal" assertion that lodash and Chai provide.

### assertDeepEqual

An "equal" assertion that checks both objects for not only structure but also values.

### templating functions

A factory where a template will yield a new function that automatically checks assertions like so:

```js
var likeTweet = skorice.templateLike({ id: '', body: '', user: '' });

likeTweet(body);
```

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