本文整理汇总了TypeScript中test/lib/common.sinon.spy方法的典型用法代码示例。如果您正苦于以下问题:TypeScript sinon.spy方法的具体用法?TypeScript sinon.spy怎么用?TypeScript sinon.spy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类test/lib/common.sinon
的用法示例。
在下文中一共展示了sinon.spy方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: beforeEach
beforeEach(function() {
historySrv = {
getHistoryList: sinon.stub(),
calculateDiff: sinon.stub(),
restoreDashboard: sinon.stub(),
};
$rootScope = {
appEvent: sinon.spy(),
onAppEvent: sinon.spy(),
};
});
示例2: beforeEach
beforeEach(angularMocks.inject(function($rootScope, $controller) {
ctx.scope = $rootScope.$new();
ctx.scope.ctrl = {
refresh: sinon.spy(),
render: sinon.spy(),
seriesList: []
};
ctx.scope.render = function() {};
ctx.controller = $controller('SeriesOverridesCtrl', {
$scope: ctx.scope
});
}));
示例3: beforeEach
beforeEach(function() {
dash = _dashboardSrv.create({
refresh: false,
rows: [
{
panels: [{ test: "asd", legend: { } }]
}
]
});
scope = _rootScope.$new();
scope.appEvent = sinon.spy();
scope.onAppEvent = sinon.spy();
tracker = new _unsavedChangesSrv.Tracker(dash, scope);
});
示例4:
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.datasource.getFuncDefs = sinon.stub().returns(ctx.$q.when(gfunc.getFuncDefs('1.0')));
ctx.datasource.getFuncDef = gfunc.getFuncDef;
ctx.datasource.waitForFuncDefsLoaded = sinon.stub().returns(ctx.$q.when(null));
ctx.datasource.createFuncInstance = gfunc.createFuncInstance;
ctx.panelCtrl = { panel: {} };
ctx.panelCtrl = {
panel: {
targets: [ctx.target],
},
};
ctx.panelCtrl.refresh = sinon.spy();
ctx.ctrl = $controller(
GraphiteQueryCtrl,
{ $scope: ctx.scope },
{
panelCtrl: ctx.panelCtrl,
datasource: ctx.datasource,
target: ctx.target,
}
);
ctx.scope.$digest();
})
示例5: 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);
});
示例6: beforeEach
beforeEach(function() {
ctx.scope.target.target = 'movingAverage(prod.count, $var)';
ctx.scope.datasource.metricFindQuery.returns(ctx.$q.when([]));
ctx.scope.init();
ctx.scope.$digest();
ctx.scope.$parent = { get_data: sinon.spy() };
});
示例7: beforeEach
beforeEach(function() {
var range = {
from: moment(new Date())
.subtract(7, 'days')
.toDate(),
to: new Date(),
};
ctx.timeSrv.timeRange = sinon.stub().returns(range);
ctx.templateSrv.setGrafanaVariable = sinon.spy();
var variableModel1 = {
type: 'interval',
query: '1s,2h,5h,1d',
name: 'variable1',
auto: true,
auto_count: 10,
};
variable1 = ctx.variableSrv.createVariableFromModel(variableModel1);
ctx.variableSrv.addVariable(variable1);
var variableModel2 = {
type: 'interval',
query: '1s,2h,5h',
name: 'variable2',
auto: true,
auto_count: 1000,
};
variable2 = ctx.variableSrv.createVariableFromModel(variableModel2);
ctx.variableSrv.addVariable(variable2);
ctx.variableSrv.updateOptions(variable1);
ctx.variableSrv.updateOptions(variable2);
ctx.$rootScope.$digest();
});
示例8: beforeEach
beforeEach(function() {
ctx.scope.target = {};
ctx.scope.$parent = { get_data: sinon.spy() };
ctx.scope.datasource = ctx.datasource;
ctx.scope.datasource.metricFindQuery = sinon.stub().returns(ctx.$q.when([]));
});
示例9:
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('');
})