Socket
Book a DemoInstallSign in
Socket

chai-signature

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chai-signature

Chai.js extensions to help with function precondition testing.

latest
Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

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

signature

FAQs

Package last updated on 07 Nov 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.