chai-rx-assert
Advanced tools
Comparing version 1.0.1 to 1.0.2
20
index.js
@@ -6,14 +6,14 @@ var rxAssert = require('rx-assert'); | ||
module.exports = function(chai, utils){ | ||
chai.Assertion.addChainableMethod('rxEqual', function(rawExpected) { | ||
var actual = this._obj; | ||
var expected = rawExpected; | ||
if (! (rawExpected instanceof Array)) { | ||
expected = slice.call(arguments); | ||
} | ||
chai.Assertion.addChainableMethod('rxEqual', function(rawExpected) { | ||
var actual = this._obj; | ||
var expected = rawExpected; | ||
if (! (rawExpected instanceof Array)) { | ||
expected = slice.call(arguments); | ||
} | ||
var result = rxAssert.isEqual(actual, expected); | ||
var result = rxAssert.isEqual(actual, expected); | ||
return this.assert(result[0], result[1]); | ||
}); | ||
return this.assert(result[0], result[1]); | ||
}); | ||
}; |
{ | ||
"name": "chai-rx-assert", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Plugin for the chai assert library for comparing observables in tests", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -15,22 +15,17 @@ # chai-rx-assert | ||
it('should return messages with delay2', () => { | ||
var scheduler = new TestScheduler(); | ||
it('should return messages with delay', () => { | ||
var scheduler = new TestScheduler(); | ||
var xs = scheduler.createHotObservable(onNext(250, 2), onCompleted(550)); | ||
var xs = scheduler.createHotObservable(onNext(250, 2), onCompleted(550)); | ||
var results = scheduler.startScheduler(() => { | ||
return xs.delay(100, scheduler); | ||
}); | ||
var results = scheduler.startScheduler(() => { | ||
return xs.delay(100, scheduler); | ||
}); | ||
var expected = [ | ||
onNext(350, 2), | ||
onCompleted(650) | ||
] | ||
expect(results.messages).to.rxEqual([onNext(350, 2), onCompleted(650)]) // assert ok | ||
expect(results.messages).to.rxEqual([onNext(350, 2), onCompleted(650)]) // assert ok | ||
// or without wrapping in list | ||
// or without wrapping in list | ||
expect(results.messages).to.rxEqual(onNext(350, 2), onCompleted(650)) // assert ok | ||
expect(results.messages).to.rxEqual(onNext(350, 2), onCompleted(650)) // assert ok | ||
}); | ||
``` |
@@ -15,17 +15,17 @@ var chai = require('chai'); | ||
describe('test rx-assert methods are present', function() { | ||
it('check isRxEqual function is present', function() { | ||
var rxEqual = expect(null).to.rxEqual; | ||
expect(rxEqual).to.be.a('function'); | ||
}); | ||
it('check isRxEqual function is present', function() { | ||
var rxEqual = expect(null).to.rxEqual; | ||
expect(rxEqual).to.be.a('function'); | ||
}); | ||
it('isRxEqual should work when expected is list', function() { | ||
var actual = [onNext(300, 1), onNext(400, 2)]; | ||
var expected = [onNext(300, 1), onNext(400, 2)]; | ||
expect(actual).rxEqual(expected); | ||
}); | ||
it('isRxEqual should work when expected is list', function() { | ||
var actual = [onNext(300, 1), onNext(400, 2)]; | ||
var expected = [onNext(300, 1), onNext(400, 2)]; | ||
expect(actual).rxEqual(expected); | ||
}); | ||
it('isRxEqual should work when expected is arguments', function() { | ||
var actual = [onNext(300, 1), onNext(400, 2)]; | ||
expect(actual).rxEqual(onNext(300, 1), onNext(400, 2)); | ||
}); | ||
it('isRxEqual should work when expected is arguments', function() { | ||
var actual = [onNext(300, 1), onNext(400, 2)]; | ||
expect(actual).rxEqual(onNext(300, 1), onNext(400, 2)); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2985
31