Parcourir la source

Update test for local time

Tobias Skarhed il y a 7 ans
Parent
commit
55111c801f
1 fichiers modifiés avec 7 ajouts et 2 suppressions
  1. 7 2
      public/app/plugins/panel/singlestat/specs/singlestat.jest.ts

+ 7 - 2
public/app/plugins/panel/singlestat/specs/singlestat.jest.ts

@@ -23,6 +23,9 @@ describe('SingleStatCtrl', function() {
   SingleStatCtrl.prototype.dashboard = {
   SingleStatCtrl.prototype.dashboard = {
     isTimezoneUtc: jest.fn(() => true),
     isTimezoneUtc: jest.fn(() => true),
   };
   };
+  SingleStatCtrl.prototype.events = {
+    on: () => {},
+  };
 
 
   function singleStatScenario(desc, func) {
   function singleStatScenario(desc, func) {
     describe(desc, function() {
     describe(desc, function() {
@@ -84,7 +87,7 @@ describe('SingleStatCtrl', function() {
     });
     });
 
 
     it('should set formatted value', 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) {
     singleStatScenario('with default values', function(ctx) {
       ctx.setup(function() {
       ctx.setup(function() {
         ctx.data = tableData;
         ctx.data = tableData;
-        ctx.ctrl.panel = {};
+        ctx.ctrl.panel = {
+          emit: () => {},
+        };
         ctx.ctrl.panel.tableColumn = 'mean';
         ctx.ctrl.panel.tableColumn = 'mean';
         ctx.ctrl.panel.format = 'none';
         ctx.ctrl.panel.format = 'none';
       });
       });