Merge branch 'testing/updateMoch' of github.com:simianhacker/kibana into testing/updateMocha
This commit is contained in:
commit
f5dde11813
|
@ -76,13 +76,14 @@ define(function (require) {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should resolve result for the next function', function (done) {
|
it('should resolve result for the next function', function (done) {
|
||||||
|
var filter = {};
|
||||||
var mapping = sinon.stub();
|
var mapping = sinon.stub();
|
||||||
mapping.returns(Promise.reject());
|
mapping.returns(Promise.reject(filter));
|
||||||
var mappingChainFn = generateMappingChain(mapping);
|
var mappingChainFn = generateMappingChain(mapping);
|
||||||
var next = sinon.stub();
|
var next = sinon.stub();
|
||||||
next.returns(Promise.resolve({ key: 'test', value: 'example' }));
|
next.returns(Promise.resolve({ key: 'test', value: 'example' }));
|
||||||
var chain = mappingChainFn(next);
|
var chain = mappingChainFn(next);
|
||||||
chain({}).then(function (result) {
|
chain(filter).then(function (result) {
|
||||||
sinon.assert.calledOnce(mapping);
|
sinon.assert.calledOnce(mapping);
|
||||||
sinon.assert.calledOnce(next);
|
sinon.assert.calledOnce(next);
|
||||||
expect(result).to.eql({ key: 'test', value: 'example' });
|
expect(result).to.eql({ key: 'test', value: 'example' });
|
||||||
|
@ -92,13 +93,14 @@ define(function (require) {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should reject with an error if no functions match', function (done) {
|
it('should reject with an error if no functions match', function (done) {
|
||||||
|
var filter = {};
|
||||||
var mapping = sinon.stub();
|
var mapping = sinon.stub();
|
||||||
mapping.returns(Promise.reject());
|
mapping.returns(Promise.reject(filter));
|
||||||
var mappingChainFn = generateMappingChain(mapping);
|
var mappingChainFn = generateMappingChain(mapping);
|
||||||
var chain = mappingChainFn();
|
var chain = mappingChainFn();
|
||||||
chain({}).catch(function (err) {
|
chain(filter).catch(function (err) {
|
||||||
expect(err).to.be.an(Error);
|
expect(err).to.be.an(Error);
|
||||||
expect(err.message).to.be('No mapping have been found for filter.');
|
expect(err.message).to.be('No mappings have been found for filter.');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
$rootScope.$apply();
|
$rootScope.$apply();
|
||||||
|
|
Loading…
Reference in a new issue