Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/p-baleine/expect-change
Change assertion extension for expect.js
https://github.com/p-baleine/expect-change
Last synced: 21 days ago
JSON representation
Change assertion extension for expect.js
- Host: GitHub
- URL: https://github.com/p-baleine/expect-change
- Owner: p-baleine
- Created: 2013-01-10T04:06:37.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-04-27T01:40:43.000Z (over 11 years ago)
- Last Synced: 2024-10-06T01:15:22.221Z (about 1 month ago)
- Language: JavaScript
- Size: 203 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# expect-change [![Build Status](https://travis-ci.org/p-baleine/expect-change.png?branch=master)](https://travis-ci.org/p-baleine/expect-change)
Change assertion extension for expect.js
```js
// sample obj
var counter = {
increment: function() {
this.counter = this.counter || 0;
this.counter += 1;
},
count: function() {
return (this.counter = this.counter || 0);
}
};// expectation
expect(function() { counter.increment(); })
.to.change(function() { return counter.count(); }).from(0).to(1);
```## How to use
### Node
Install `expect.js` and `expect-change` with NPM or add it to your package.json:
```js
$ npm install expect.js expect-change
```Then:
```js
var expect = require('expect.js'),
expectChange = require('expect-change');
```### Browser
Include script tag after `expect.js`
```html
```
## API
**change**: check if the value is changed
**to**: check if the value is changed to expected value
**from**: heck if the value is changed from expected value