grafana/public/test/specs/overview-ctrl-specs.js

31 lines
785 B
JavaScript
Raw Normal View History

2014-08-06 09:09:26 -05:00
define([
2014-08-07 07:09:07 -05:00
'./helpers',
2014-08-06 09:09:26 -05:00
'panels/overview/module'
2014-08-07 07:09:07 -05:00
], function(helpers) {
2014-08-06 09:09:26 -05:00
'use strict';
describe('OverviewCtrl', function() {
2014-08-07 07:09:07 -05:00
var ctx = new helpers.ControllerTestContext();
2014-08-06 09:09:26 -05:00
beforeEach(module('grafana.services'));
beforeEach(module('grafana.panels.overview'));
beforeEach(ctx.providePhase());
beforeEach(ctx.createControllerPhase('OverviewCtrl'));
2014-08-06 09:09:26 -05:00
describe('when query return error', function() {
2014-08-06 09:09:26 -05:00
beforeEach(function() {
ctx.datasource.query = function() {
return ctx.$q.reject({ message: 'Some error' });
};
ctx.scope.get_data();
ctx.scope.$digest();
2014-08-06 09:09:26 -05:00
});
it('panel.error should be set', function() {
expect(ctx.scope.panel.error).to.be("Some error");
2014-08-06 09:09:26 -05:00
});
});
});
});