Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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.

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
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

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc