Преглед изворни кода

tests: found the unhandled promise issue in the dash import tests

Torkel Ödegaard пре 8 година
родитељ
комит
9e61cacd16
2 измењених фајлова са 5 додато и 3 уклоњено
  1. 4 2
      public/app/features/dashboard/specs/dash_import_ctrl_specs.ts
  2. 1 1
      public/test/index.ts

+ 4 - 2
public/app/features/dashboard/specs/dash_import_ctrl_specs.ts

@@ -53,9 +53,10 @@ describe('DashImportCtrl', function() {
       // setup api mock
       // setup api mock
       backendSrv.get = sinon.spy(() => {
       backendSrv.get = sinon.spy(() => {
         return Promise.resolve({
         return Promise.resolve({
+          json: {}
         });
         });
       });
       });
-      ctx.ctrl.checkGnetDashboard();
+      return ctx.ctrl.checkGnetDashboard();
     });
     });
 
 
     it('should call gnet api with correct dashboard id', function() {
     it('should call gnet api with correct dashboard id', function() {
@@ -69,9 +70,10 @@ describe('DashImportCtrl', function() {
       // setup api mock
       // setup api mock
       backendSrv.get = sinon.spy(() => {
       backendSrv.get = sinon.spy(() => {
         return Promise.resolve({
         return Promise.resolve({
+          json: {}
         });
         });
       });
       });
-      ctx.ctrl.checkGnetDashboard();
+      return ctx.ctrl.checkGnetDashboard();
     });
     });
 
 
     it('should call gnet api with correct dashboard id', function() {
     it('should call gnet api with correct dashboard id', function() {

+ 1 - 1
public/test/index.ts

@@ -21,7 +21,7 @@ angular.module('grafana.directives', []);
 angular.module('grafana.filters', []);
 angular.module('grafana.filters', []);
 angular.module('grafana.routes', ['ngRoute']);
 angular.module('grafana.routes', ['ngRoute']);
 
 
-const context = (<any>require).context('../', true, /specs/);
+const context = (<any>require).context('../', true, /specs\.(tsx?|js)/);
 for (let key of context.keys()) {
 for (let key of context.keys()) {
   context(key);
   context(key);
 }
 }