Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    chai-signaturepublic

    CHAI-SIGNATURE

    chai-signature is a Chai.js assertion library extension to make function precondition testing much easier.

    If you find yourself doing a lot of these these kind of tests:

    var self = this;
    
    expect(function() {
      self.method(null);
    }).to.throw(/ArgumentError/)
    

    With chai-signature it's much shorter and more straightforward:

    expect(this.method).bind(this).calledWith(null).to.throw();
    

    Or the more generally-used shorter version with functions already bound:

    expect(this.method).called(null).to.throw();
    

    API:

    All functions expect the expect object to be a function.

    .bind( [obj] )

    .bindTo( [obj] )

    .boundTo( [obj] )

    Binds the source function to obj.

    .called( [arg [, arg [, arg... ]]] )

    .calledWith( [arg [, arg [, arg... ]]] )

    Converts the subject (which is a function) into a function call of the subject with the arguments pre-applied.

    Keywords

    none

    install

    npm i chai-signature

    Downloadsweekly downloads

    4

    version

    0.1.0

    license

    none

    repository

    githubgithub

    last publish

    collaborators

    • avatar