0.1.2 • Published 8 years ago

expect-async v0.1.2

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

expect-async

expect-async is a wrapper for expect that allows for use in asynchronous tests.

var createExpect = require('expect-async').createExpect;

it('should open a file that contains "foo"', function(done) {
    //A test fails if an argument is passed to 'done'.
    var expect = createExpect(done);

    fs.readFile('file.txt', 'utf8', function(err, data) {
        expect(err).toNotExist();
        expect(data).toBe('foo');

        done();
    });
});

Usage

createExpect(reject)

Params

reject: A function that accepts an Error argument. Will be called when an expectation fails.

Returns

An expect object that behaves like expect. When an expectation fails, reject will be called before an exception is thrown.

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago