0.0.7 • Published 8 years ago

chai-spies-decorators v0.0.7

Weekly downloads
3
License
Unlicense
Repository
github
Last release
8 years ago

chai-spies-decorators

npm install chai-spies-decorators

Provides ES7 decorators interface for chai-spies, allowing to set execution contracts on class methods in a nice declarative way. Requires Mocha.

import 'chai-spies-decorators'

describe ('example', () => {

	it ('works', () => {

		const foo = new (class Foo {

			@will.have.been.called.with (42).once
			bar () { }

			@will.have.been.called.twice
			zap () { }
		})

		foo.bar (42)
		foo.zap (); foo.zap ()
	})

})

How it works

I've written an article on Medium explaining it: Wiring ES7 decorators to Chai Spies for declarative contracts on class methods: A metaprogramming case study.

Warning

It is not very well tested with asynchronous tests. Should work with Promises, but not with done callback (not implemented).

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago