當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript common.sinon類代碼示例

本文整理匯總了TypeScript中test/lib/common.sinon的典型用法代碼示例。如果您正苦於以下問題:TypeScript sinon類的具體用法?TypeScript sinon怎麽用?TypeScript sinon使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了sinon類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: beforeEach

  beforeEach(angularMocks.inject(($rootScope, $controller, $q) => {
    ctx.$q = $q;
    ctx.scope = $rootScope.$new();
    ctx.target = {target: 'aliasByNode(scaleToSeconds(test.prod.*,1),2)'};
    ctx.datasource.metricFindQuery = sinon.stub().returns(ctx.$q.when([]));
    ctx.panelCtrl = {panel: {}};
    ctx.panelCtrl.refresh = sinon.spy();

    ctx.ctrl = $controller(GraphiteQueryCtrl, {$scope: ctx.scope}, {
      panelCtrl: ctx.panelCtrl,
      datasource: ctx.datasource,
      target: ctx.target
    });
    ctx.scope.$digest();
  }));
開發者ID:Sensetif,項目名稱:grafana,代碼行數:15,代碼來源:query_ctrl_specs.ts

示例2: beforeEach

  beforeEach(function() {
    dash = _dashboardSrv.create({
      refresh: false,
      panels: [{ test: 'asd', legend: {} }],
      rows: [
        {
          panels: [{ test: 'asd', legend: {} }],
        },
      ],
    });
    scope = _rootScope.$new();
    scope.appEvent = sinon.spy();
    scope.onAppEvent = sinon.spy();

    tracker = new Tracker(dash, scope, undefined, _location, _window, _timeout, contextSrv, _rootScope);
  });
開發者ID:GPegel,項目名稱:grafana,代碼行數:16,代碼來源:unsaved_changes_srv_specs.ts

示例3: beforeEach

      beforeEach(function() {
        scenario.setupFn();
        ctx.datasource = {};
        ctx.datasource.metricFindQuery = sinon.stub().returns(ctx.$q.when(scenario.queryResult));

        ctx.datasourceSrv.get = sinon.stub().returns(ctx.$q.when(ctx.datasource));
        ctx.datasourceSrv.getMetricSources = sinon.stub().returns(scenario.metricSources);

        ctx.$location.search = sinon.stub().returns(scenario.urlParams);
        ctx.dashboard = {templating: {list: scenario.variables}, events: new Emitter()};

        ctx.variableSrv.init(ctx.dashboard);
        ctx.$rootScope.$digest();

        scenario.variables = ctx.variableSrv.variables;
      });
開發者ID:PaulMest,項目名稱:grafana,代碼行數:16,代碼來源:variable_srv_init_specs.ts

示例4: beforeEach

 beforeEach(function() {
   ctx.scope.target.target = 'asPercent(#A, #B)';
   ctx.scope.datasource.metricFindQuery.returns(ctx.$q.when([]));
   ctx.scope.init();
   ctx.scope.$digest();
   ctx.scope.$parent = { get_data: sinon.spy() };
 });
開發者ID:masato25,項目名稱:grafana,代碼行數:7,代碼來源:query_ctrl_specs.ts

示例5: beforeEach

  beforeEach(angularMocks.inject(($rootScope, $controller, $q) => {
    ctx.$q = $q;
    ctx.scope = $rootScope.$new();
    ctx.target = {target: ''};
    ctx.panelCtrl = {panel: {}};
    ctx.panelCtrl.refresh = sinon.spy();
    ctx.datasource.getAggregators = sinon.stub().returns(ctx.$q.when([]));
    ctx.datasource.getFilterTypes = sinon.stub().returns(ctx.$q.when([]));

    ctx.ctrl = $controller(OpenTsQueryCtrl, {$scope: ctx.scope}, {
      panelCtrl: ctx.panelCtrl,
      datasource: ctx.datasource,
      target: ctx.target,
    });
    ctx.scope.$digest();
  }));
開發者ID:Sensetif,項目名稱:grafana,代碼行數:16,代碼來源:query-ctrl-specs.ts

示例6: beforeEach

  beforeEach(function() {
    dash = _dashboardSrv.create({
      refresh: false,
      panels: [{ test: 'asd', legend: {} }],
      rows: [
        {
          panels: [{ test: 'asd', legend: {} }],
        },
      ],
    });
    scope = _rootScope.$new();
    scope.appEvent = sinon.spy();
    scope.onAppEvent = sinon.spy();

    tracker = new _unsavedChangesSrv.Tracker(dash, scope);
  });
開發者ID:arcolife,項目名稱:grafana,代碼行數:16,代碼來源:unsaved_changes_srv_specs.ts

示例7:

 angularMocks.inject(function($controller, $rootScope, $q, $httpBackend) {
   rootScope = $rootScope;
   q = $q;
   scope = $rootScope.$new();
   ctrl = $controller('ValueSelectDropdownCtrl', { $scope: scope });
   ctrl.onUpdated = sinon.spy();
   $httpBackend.when('GET', /\.html$/).respond('');
 })
開發者ID:GPegel,項目名稱:grafana,代碼行數:8,代碼來源:value_select_dropdown_specs.ts

示例8: beforeEach

 beforeEach(angularMocks.inject(($rootScope, $controller, $q) => {
   ctx.$q = $q;
   ctx.scope = $rootScope.$new();
   ctx.datasource.metricFindQuery = sinon.stub().returns(ctx.$q.when([]));
   ctx.target = {target: {}};
   ctx.panelCtrl = {
     panel: {
       targets: [ctx.target]
     }
   };
   ctx.panelCtrl.refresh = sinon.spy();
   ctx.ctrl = $controller(InfluxQueryCtrl, {$scope: ctx.scope}, {
     panelCtrl: ctx.panelCtrl,
     target: ctx.target,
     datasource: ctx.datasource
   });
 }));
開發者ID:PaulMest,項目名稱:grafana,代碼行數:17,代碼來源:query_ctrl_specs.ts


注:本文中的test/lib/common.sinon類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。