本文整理汇总了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;未经允许,请勿转载。 |
请发表评论