Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Additional utility Chai assertions
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
.gitignore
LICENSE
README.md
chai-extras.js
package.json

README.md

chai-extras

These are some additional chai plugins that I've found useful for basic data comparison

Assertions

atLeast

Assert that the subject is >= to the value provided

versionNumber.should.be.atLeast(10.2)
expect(versionNumber).to.be.atLeast(10.2)

atMost

Assert that the subject is <= to the value provided

paginatedEntries.should.be.atMost(entriesPerPage)
expect(paginatedEntries).to.be.atMost(entriesPerPage)

method/methods

Assert that the subject has the method(s)

user.should.have.method('login')
expect(user).to.have.methods(['login', 'logout']);

Usage

To install, just do npm install chai-extras

Browser

Just include chai-extras.js in a <script> tag after including chai. It will attach itself to the global

AMD/Node

define(function(require){
    var chai = require('chai');
    var extras = require('extras');    
    chai.use(extras);
});

Tests

  1. install dependencies with npm install
  2. open test/index.html
Something went wrong with that request. Please try again.