Commit 26f709e8 by Tobias Skarhed

Karm to Jest

parent 715c82b6
import { describe, beforeEach, it, expect, angularMocks } from '../../../../../test/lib/common';
import moment from 'moment'; import moment from 'moment';
import { HeatmapCtrl } from '../heatmap_ctrl'; import { HeatmapCtrl } from '../heatmap_ctrl';
import helpers from '../../../../../test/specs/helpers';
describe('HeatmapCtrl', function() { describe('HeatmapCtrl', function() {
var ctx = new helpers.ControllerTestContext(); let ctx = <any>{};
beforeEach(angularMocks.module('grafana.services')); let $injector = {
beforeEach(angularMocks.module('grafana.controllers')); get: () => {}
beforeEach( };
angularMocks.module(function($compileProvider) {
$compileProvider.preAssignBindingsEnabled(true);
})
);
beforeEach(ctx.providePhase()); let $scope = {
beforeEach(ctx.createPanelController(HeatmapCtrl)); $on: () => {},
beforeEach(() => { events: {
ctx.ctrl.annotationsPromise = Promise.resolve({}); on: () => {}
ctx.ctrl.updateTimeRange(); }
}); };
HeatmapCtrl.prototype.panel = {
events: {
on: () => {},
emit: () => {}
}
};
beforeEach(() => {
ctx.ctrl = new HeatmapCtrl($scope, $injector, {});
});
describe('when time series are outside range', function() { describe('when time series are outside range', function() {
beforeEach(function() { beforeEach(function() {
...@@ -36,7 +40,7 @@ describe('HeatmapCtrl', function() { ...@@ -36,7 +40,7 @@ describe('HeatmapCtrl', function() {
}); });
it('should set datapointsOutside', function() { it('should set datapointsOutside', function() {
expect(ctx.ctrl.dataWarning.title).to.be('Data points outside time range'); expect(ctx.ctrl.dataWarning.title).toBe('Data points outside time range');
}); });
}); });
...@@ -61,7 +65,7 @@ describe('HeatmapCtrl', function() { ...@@ -61,7 +65,7 @@ describe('HeatmapCtrl', function() {
}); });
it('should set datapointsOutside', function() { it('should set datapointsOutside', function() {
expect(ctx.ctrl.dataWarning).to.be(null); expect(ctx.ctrl.dataWarning).toBe(null);
}); });
}); });
...@@ -72,7 +76,7 @@ describe('HeatmapCtrl', function() { ...@@ -72,7 +76,7 @@ describe('HeatmapCtrl', function() {
}); });
it('should set datapointsCount warning', function() { it('should set datapointsCount warning', function() {
expect(ctx.ctrl.dataWarning.title).to.be('No data points'); expect(ctx.ctrl.dataWarning.title).toBe('No data points');
}); });
}); });
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment