mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Merge pull request #4032 from spalger/testing/updateMocha
[testing] update mocha
This commit is contained in:
commit
d2945b67fa
4 changed files with 14 additions and 10 deletions
|
@ -94,7 +94,7 @@
|
|||
"marked": "^0.3.2",
|
||||
"marked-text-renderer": "^0.1.0",
|
||||
"mkdirp": "^0.5.0",
|
||||
"mocha": "~1.20.1",
|
||||
"mocha": "^2.2.5",
|
||||
"mocha-screencast-reporter": "~0.1.4",
|
||||
"opn": "~1.0.0",
|
||||
"path-browserify": "0.0.0",
|
||||
|
|
|
@ -14,7 +14,7 @@ define(function (require) {
|
|||
if (result === filter) {
|
||||
return next(filter);
|
||||
}
|
||||
throw result;
|
||||
return Promise.reject(result);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
|
|
@ -52,7 +52,6 @@ define(function (require) {
|
|||
}
|
||||
|
||||
describe('with table ' + JSON.stringify(tableOpts), function () {
|
||||
|
||||
it('outputs a chart', function () {
|
||||
var table = makeTable();
|
||||
var chart = makeSingleChart(table);
|
||||
|
@ -100,6 +99,8 @@ define(function (require) {
|
|||
|
||||
describe('properties', function () {
|
||||
it('includes one feature per row in the table', function () {
|
||||
this.timeout(0);
|
||||
|
||||
var table = makeTable();
|
||||
var chart = makeSingleChart(table);
|
||||
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) {
|
||||
var filter = {};
|
||||
var mapping = sinon.stub();
|
||||
mapping.returns(Promise.reject());
|
||||
mapping.returns(Promise.reject(filter));
|
||||
var mappingChainFn = generateMappingChain(mapping);
|
||||
var next = sinon.stub();
|
||||
next.returns(Promise.resolve('good'));
|
||||
var chain = mappingChainFn(next);
|
||||
chain({}).then(function (result) {
|
||||
chain(filter).then(function (result) {
|
||||
expect(result).to.be('good');
|
||||
sinon.assert.calledOnce(next);
|
||||
done();
|
||||
|
@ -75,13 +76,14 @@ define(function (require) {
|
|||
});
|
||||
|
||||
it('should resolve result for the next function', function (done) {
|
||||
var filter = {};
|
||||
var mapping = sinon.stub();
|
||||
mapping.returns(Promise.reject());
|
||||
mapping.returns(Promise.reject(filter));
|
||||
var mappingChainFn = generateMappingChain(mapping);
|
||||
var next = sinon.stub();
|
||||
next.returns(Promise.resolve({ key: 'test', value: 'example' }));
|
||||
var chain = mappingChainFn(next);
|
||||
chain({}).then(function (result) {
|
||||
chain(filter).then(function (result) {
|
||||
sinon.assert.calledOnce(mapping);
|
||||
sinon.assert.calledOnce(next);
|
||||
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) {
|
||||
var filter = {};
|
||||
var mapping = sinon.stub();
|
||||
mapping.returns(Promise.reject());
|
||||
mapping.returns(Promise.reject(filter));
|
||||
var mappingChainFn = generateMappingChain(mapping);
|
||||
var chain = mappingChainFn();
|
||||
chain({}).catch(function (err) {
|
||||
chain(filter).catch(function (err) {
|
||||
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();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue