From 55111c801fbdc74687d74136dc73daf2aa29131c Mon Sep 17 00:00:00 2001 From: Tobias Skarhed Date: Fri, 27 Jul 2018 13:41:07 +0200 Subject: [PATCH] Update test for local time --- .../plugins/panel/singlestat/specs/singlestat.jest.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/panel/singlestat/specs/singlestat.jest.ts b/public/app/plugins/panel/singlestat/specs/singlestat.jest.ts index 7e8915ca537..dd02b5c169c 100644 --- a/public/app/plugins/panel/singlestat/specs/singlestat.jest.ts +++ b/public/app/plugins/panel/singlestat/specs/singlestat.jest.ts @@ -23,6 +23,9 @@ describe('SingleStatCtrl', function() { SingleStatCtrl.prototype.dashboard = { isTimezoneUtc: jest.fn(() => true), }; + SingleStatCtrl.prototype.events = { + on: () => {}, + }; function singleStatScenario(desc, func) { describe(desc, function() { @@ -84,7 +87,7 @@ describe('SingleStatCtrl', function() { }); it('should set formatted value', function() { - expect(ctx.data.valueFormatted).toBe('2017-09-17 09:56:37'); + expect(moment(ctx.data.valueFormatted).isSame('2017-09-17 09:56:37')).toBe(true); }); }); @@ -235,7 +238,9 @@ describe('SingleStatCtrl', function() { singleStatScenario('with default values', function(ctx) { ctx.setup(function() { ctx.data = tableData; - ctx.ctrl.panel = {}; + ctx.ctrl.panel = { + emit: () => {}, + }; ctx.ctrl.panel.tableColumn = 'mean'; ctx.ctrl.panel.format = 'none'; });