0.0.3 • Published 9 years ago

chai-hy-res v0.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

chai-hy-res Build Status

A ChaiJs plugin for making assertions about hy-res

Installation

NPM

chai-hy-res is available via NPM. To install:

$ npm install --save-dev chai-hy-res

Setup

var chai = require('chai');
chai.use(require('chai-hy-res'));

Usage

Resource State Assertions

There are several assertions about the state of a hy-res resource being resolved or unresolved.

Asserting an unresolved resource:

expect(res.$followOne('next')).to.be.an.unresolved.resource;

For asserting resolved resource, it is often helpful to use the plugin in combination with chai-as-promised:

expect(res.$followOne('next').$promise).to.eventually.be.a.resolved.resource;

Link Assertions

You can assert on the presence and properties of links in the resource as well:

expect(res).to.have.link('next').with.property('href', '/posts/123');

Asserting on the absense of a link works as well:

expect(res).to.not.have.link('prev');
0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago