Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chai-changes

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chai-changes - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

.travis.yml

8

chai-changes.js

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.3.2
(function() {

@@ -40,3 +40,3 @@

result = val();
isPromise = typeof result.then === 'function';
isPromise = (typeof result === 'object') && (typeof result.then === 'function');
if (((typeof DS !== "undefined" && DS !== null ? DS.Model : void 0) != null) && result instanceof DS.Model) {

@@ -66,4 +66,6 @@ isPromise = false;

newPromise = result.then(promiseCallback, promiseCallback);
if (newPromise != null ? newPromise.then : void 0) {
this.then = newPromise.then;
}
flag(this, 'object', newPromise);
this.then = newPromise.then;
} else {

@@ -70,0 +72,0 @@ for (_j = 0, _len1 = definedActions.length; _j < _len1; _j++) {

@@ -6,3 +6,3 @@ {

"keywords": [ "test", "assertion", "assert", "testing", "changes", "promises" ],
"version": "1.1.0",
"version": "1.1.1",
"repository": {

@@ -18,7 +18,9 @@ "type": "git",

"chai-as-promised": ">= 3.2.3",
"coffee-script": ">= 1.4.0",
"chai": ">= 1.0.0",
"when": "*",
"mocha": ">= 1.0.0"
},
"scripts": {
"test": "./test.sh"
"test": "mocha"
},

@@ -25,0 +27,0 @@ "licenses": [

chai-changes
============
[![Build Status](https://travis-ci.org/matthijsgroen/chai-changes.png?branch=master)](https://travis-ci.org/matthijsgroen/chai-changes)
chai-changes is an extension to the [chai](http://chaijs.com/) assertion library that
provides a set of change-specific assertions.
Usage
-----
Include `chai-changes.js` in your test file, after `chai.js` (version 1.0.0-rc1 or later):
<script src="chai-changes.js"></script>
Use the assertions with chai's `expect` or `should` assertions.
Assertions

@@ -21,7 +14,8 @@ ----------

Using 'expect':
expect(-> codeThatYieldsAChangedResult).to....when ->
executeTheCodeThatCausesTheChange()
```coffeescript
expect(-> codeThatYieldsAChangedResult).to....when ->
executeTheCodeThatCausesTheChange()
```

@@ -35,4 +29,6 @@ The code within the `expect` section will be executed first, then the

(-> codeThatYieldsAChangedResult).should....when ->
executeTheCodeThatCausesTheChange()
```coffeescript
(-> codeThatYieldsAChangedResult).should....when ->
executeTheCodeThatCausesTheChange()
```

@@ -61,6 +57,8 @@ ### when

result = 0
(-> result).should.change.when -> result += 1
expect(-> result).to.change.when -> result -= 1
expect(-> result).not.to.change.when -> result = result * 1
```coffeescript
result = 0
(-> result).should.change.when -> result += 1
expect(-> result).to.change.when -> result -= 1
expect(-> result).not.to.change.when -> result = result * 1
```

@@ -71,6 +69,8 @@ ### `change.by(delta)`

result = 0
(-> result).should.change.by(3).when -> result += 3
expect(-> result).not.to.change.by(-3).when -> result += 1
expect(-> result).to.change.by(-2).when -> result -= 2
```coffeescript
result = 0
(-> result).should.change.by(3).when -> result += 3
expect(-> result).not.to.change.by(-3).when -> result += 1
expect(-> result).to.change.by(-2).when -> result -= 2
```

@@ -82,5 +82,7 @@ ### `change.from(startValue)`

result = ['a', 'b']
(-> result).should.change.from(['a', 'b']).when -> result.push('c')
(-> result).should.change.from(['a', 'b']).to(['a', 'b', 'c']).when -> result.push('c')
```coffeescript
result = ['a', 'b']
(-> result).should.change.from(['a', 'b']).when -> result.push('c')
(-> result).should.change.from(['a', 'b']).to(['a', 'b', 'c']).when -> result.push('c')
```

@@ -92,6 +94,48 @@ ### `change.to(endValue)`

result = ['a', 'b']
(-> result).should.change.to(['a', 'b', 'c']).when -> result.push('c')
(-> result).should.change.from(['a', 'b']).to(['a', 'c']).when -> result = ['a', 'c']
```coffeescript
result = ['a', 'b']
(-> result).should.change.to(['a', 'b', 'c']).when -> result.push('c')
(-> result).should.change.from(['a', 'b']).to(['a', 'c']).when -> result = ['a', 'c']
```
## Installation and Setup
### Node
Do an `npm install chai-changes` to get up and running. Then:
```javascript
var chai = require("chai");
var chaiChanges = require("chai-changes");
chai.use(chaiChanges);
```
You can of course put this code in a common test fixture file; for an example using [Mocha][mocha]
### AMD
Chai Changes supports being used as an [AMD][amd] module, registering itself anonymously (just like Chai). So,
assuming you have configured your loader to map the Chai and Chai Changes files to the respective module IDs
`"chai"` and `"chai-changes"`, you can use them as follows:
```javascript
define(function (require, exports, module) {
var chai = require("chai");
var chaiChanges = require("chai-changes");
chai.use(chaiChanges);
});
```
### `<script>` tag
If you include Chai Changes directly with a `<script>` tag, after the one for Chai itself, then it will
automatically plug in to Chai and be ready for use:
```html
<script src="chai.js"></script>
<script src="chai-changes.js"></script>
```
## License

@@ -102,1 +146,5 @@

MIT License (see the LICENSE file)
[chai]: http://chaijs.com/
[mocha]: http://visionmedia.github.com/mocha/
[amd]: https://github.com/amdjs/amdjs-api/wiki/AMD

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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