Merge pull request #4032 from spalger/testing/updateMocha
[testing] update mocha
This commit is contained in:
commit
d2945b67fa
|
@ -94,7 +94,7 @@
|
||||||
"marked": "^0.3.2",
|
"marked": "^0.3.2",
|
||||||
"marked-text-renderer": "^0.1.0",
|
"marked-text-renderer": "^0.1.0",
|
||||||
"mkdirp": "^0.5.0",
|
"mkdirp": "^0.5.0",
|
||||||
"mocha": "~1.20.1",
|
"mocha": "^2.2.5",
|
||||||
"mocha-screencast-reporter": "~0.1.4",
|
"mocha-screencast-reporter": "~0.1.4",
|
||||||
"opn": "~1.0.0",
|
"opn": "~1.0.0",
|
||||||
"path-browserify": "0.0.0",
|
"path-browserify": "0.0.0",
|
||||||
|
|
|
@ -14,7 +14,7 @@ define(function (require) {
|
||||||
if (result === filter) {
|
if (result === filter) {
|
||||||
return next(filter);
|
return next(filter);
|
||||||
}
|
}
|
||||||
throw result;
|
return Promise.reject(result);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -52,7 +52,6 @@ define(function (require) {
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('with table ' + JSON.stringify(tableOpts), function () {
|
describe('with table ' + JSON.stringify(tableOpts), function () {
|
||||||
|
|
||||||
it('outputs a chart', function () {
|
it('outputs a chart', function () {
|
||||||
var table = makeTable();
|
var table = makeTable();
|
||||||
var chart = makeSingleChart(table);
|
var chart = makeSingleChart(table);
|
||||||
|
@ -100,6 +99,8 @@ define(function (require) {
|
||||||
|
|
||||||
describe('properties', function () {
|
describe('properties', function () {
|
||||||
it('includes one feature per row in the table', function () {
|
it('includes one feature per row in the table', function () {
|
||||||
|
this.timeout(0);
|
||||||
|
|
||||||
var table = makeTable();
|
var table = makeTable();
|
||||||
var chart = makeSingleChart(table);
|
var chart = makeSingleChart(table);
|
||||||
var geoColI = _.findIndex(table.columns, { aggConfig: aggs.geo });
|
var geoColI = _.findIndex(table.columns, { aggConfig: aggs.geo });
|
||||||
|
|
|
@ -15,13 +15,14 @@ define(function (require) {
|
||||||
|
|
||||||
|
|
||||||
it('should create a chaning function which calls the next function if the promise is rejected', function (done) {
|
it('should create a chaning function which calls the next function if the promise is rejected', 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('good'));
|
next.returns(Promise.resolve('good'));
|
||||||
var chain = mappingChainFn(next);
|
var chain = mappingChainFn(next);
|
||||||
chain({}).then(function (result) {
|
chain(filter).then(function (result) {
|
||||||
expect(result).to.be('good');
|
expect(result).to.be('good');
|
||||||
sinon.assert.calledOnce(next);
|
sinon.assert.calledOnce(next);
|
||||||
done();
|
done();
|
||||||
|
@ -75,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' });
|
||||||
|
@ -91,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