overview-ctrl-specs.js 785 B

123456789101112131415161718192021222324252627282930
  1. define([
  2. './helpers',
  3. 'panels/overview/module'
  4. ], function(helpers) {
  5. 'use strict';
  6. describe('OverviewCtrl', function() {
  7. var ctx = new helpers.ControllerTestContext();
  8. beforeEach(module('grafana.services'));
  9. beforeEach(module('grafana.panels.overview'));
  10. beforeEach(ctx.providePhase());
  11. beforeEach(ctx.createControllerPhase('OverviewCtrl'));
  12. describe('when query return error', function() {
  13. beforeEach(function() {
  14. ctx.datasource.query = function() {
  15. return ctx.$q.reject({ message: 'Some error' });
  16. };
  17. ctx.scope.get_data();
  18. ctx.scope.$digest();
  19. });
  20. it('panel.error should be set', function() {
  21. expect(ctx.scope.panel.error).to.be("Some error");
  22. });
  23. });
  24. });
  25. });