Skip to content

Commit 7492c46

Browse files
committed
test: upgrade to sinon@2
1 parent 07fdee1 commit 7492c46

File tree

20 files changed

+111
-111
lines changed

20 files changed

+111
-111
lines changed

lib/agent/api/index.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ describe('The Trace CollectorApi module', function () {
127127
var collectorApi = CollectorApi.create(defaultConfig)
128128
collectorApi.serviceKey = serviceKey
129129

130-
this.sandbox.stub(https, 'request', function (_, cb) {
130+
this.sandbox.stub(https, 'request').callsFake(function (_, cb) {
131131
process.nextTick(function () {
132132
cb(new FakeReadable())
133133
})
@@ -145,7 +145,7 @@ describe('The Trace CollectorApi module', function () {
145145
var collectorApi = CollectorApi.create(defaultConfig)
146146
collectorApi.serviceKey = serviceKey
147147

148-
this.sandbox.stub(https, 'request', function (_, cb) {
148+
this.sandbox.stub(https, 'request').callsFake(function (_, cb) {
149149
process.nextTick(function () {
150150
cb(new FakeReadable(new Error('uh-oh')))
151151
})
@@ -169,7 +169,7 @@ describe('The Trace CollectorApi module', function () {
169169
test: 'clearly a mock'
170170
}
171171

172-
this.sandbox.stub(Date.prototype, 'toISOString', function () {
172+
this.sandbox.stub(Date.prototype, 'toISOString').callsFake(function () {
173173
return 'time'
174174
})
175175

@@ -283,7 +283,7 @@ describe('The Trace CollectorApi module', function () {
283283

284284
this.timeout(500)
285285

286-
this.sandbox.stub(collectorApi, 'getService', function () {
286+
this.sandbox.stub(collectorApi, 'getService').callsFake(function () {
287287
done()
288288
})
289289
})

lib/agent/metrics/apm/index.spec.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,26 @@ describe('The ApmMetrics module', function () {
4444
marksweep: 1
4545
}
4646

47-
this.sandbox.stub(eventLoopStats, 'sense', function () {
47+
this.sandbox.stub(eventLoopStats, 'sense').callsFake(function () {
4848
return _eventLoopStats
4949
})
50-
this.sandbox.stub(process, '_getActiveRequests', function () {
50+
this.sandbox.stub(process, '_getActiveRequests').callsFake(function () {
5151
return new Array(activeRequests)
5252
})
53-
this.sandbox.stub(process, '_getActiveHandles', function () {
53+
this.sandbox.stub(process, '_getActiveHandles').callsFake(function () {
5454
return new Array(activeHandlers)
5555
})
56-
this.sandbox.stub(process, 'memoryUsage', function () {
56+
this.sandbox.stub(process, 'memoryUsage').callsFake(function () {
5757
return {
5858
rss: memoryRss,
5959
heapTotal: memoryTotal,
6060
heapUsed: memoryUsed
6161
}
6262
})
63-
this.sandbox.stub(Date.prototype, 'toISOString', function () {
63+
this.sandbox.stub(Date.prototype, 'toISOString').callsFake(function () {
6464
return ISOString
6565
})
66-
this.sandbox.stub(os, 'loadavg', function () {
66+
this.sandbox.stub(os, 'loadavg').callsFake(function () {
6767
return [loadAvg]
6868
})
6969

@@ -131,23 +131,23 @@ describe('The ApmMetrics module', function () {
131131
}
132132

133133
this.sandbox.stub(eventLoopStats, 'sense')
134-
this.sandbox.stub(process, '_getActiveRequests', function () {
134+
this.sandbox.stub(process, '_getActiveRequests').callsFake(function () {
135135
return new Array(activeRequests)
136136
})
137-
this.sandbox.stub(process, '_getActiveHandles', function () {
137+
this.sandbox.stub(process, '_getActiveHandles').callsFake(function () {
138138
return new Array(activeHandlers)
139139
})
140-
this.sandbox.stub(process, 'memoryUsage', function () {
140+
this.sandbox.stub(process, 'memoryUsage').callsFake(function () {
141141
return {
142142
rss: memoryRss,
143143
heapTotal: memoryTotal,
144144
heapUsed: memoryUsed
145145
}
146146
})
147-
this.sandbox.stub(Date.prototype, 'toISOString', function () {
147+
this.sandbox.stub(Date.prototype, 'toISOString').callsFake(function () {
148148
return ISOString
149149
})
150-
this.sandbox.stub(os, 'loadavg', function () {
150+
this.sandbox.stub(os, 'loadavg').callsFake(function () {
151151
return [loadAvg]
152152
})
153153

lib/agent/metrics/custom/index.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('The CustomMetrics module', function () {
99
sendCustomMetrics: this.sandbox.spy()
1010
}
1111

12-
this.sandbox.stub(Date.prototype, 'toISOString', function () {
12+
this.sandbox.stub(Date.prototype, 'toISOString').callsFake(function () {
1313
return ISOString
1414
})
1515

@@ -51,7 +51,7 @@ describe('The CustomMetrics module', function () {
5151
sendCustomMetrics: this.sandbox.spy()
5252
}
5353

54-
this.sandbox.stub(Date.prototype, 'toISOString', function () {
54+
this.sandbox.stub(Date.prototype, 'toISOString').callsFake(function () {
5555
return ISOString
5656
})
5757

lib/agent/metrics/externalEdge/index.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('The ExternalEdgeMetrics module', function () {
1717
}
1818
})
1919

20-
this.sandbox.stub(Date.prototype, 'toISOString', function () {
20+
this.sandbox.stub(Date.prototype, 'toISOString').callsFake(function () {
2121
return ISOString
2222
})
2323

@@ -43,7 +43,7 @@ describe('The ExternalEdgeMetrics module', function () {
4343
}
4444
})
4545

46-
this.sandbox.stub(Date.prototype, 'toISOString', function () {
46+
this.sandbox.stub(Date.prototype, 'toISOString').callsFake(function () {
4747
return ISOString
4848
})
4949

lib/agent/metrics/incomingEdge/index.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('The IncomingEdgeMetrics module', function () {
1616
}
1717
})
1818

19-
this.sandbox.stub(Date.prototype, 'toISOString', function () {
19+
this.sandbox.stub(Date.prototype, 'toISOString').callsFake(function () {
2020
return ISOString
2121
})
2222

@@ -41,7 +41,7 @@ describe('The IncomingEdgeMetrics module', function () {
4141
}
4242
})
4343

44-
this.sandbox.stub(Date.prototype, 'toISOString', function () {
44+
this.sandbox.stub(Date.prototype, 'toISOString').callsFake(function () {
4545
return ISOString
4646
})
4747

@@ -107,7 +107,7 @@ describe('The IncomingEdgeMetrics module', function () {
107107
}
108108
})
109109

110-
this.sandbox.stub(Date.prototype, 'toISOString', function () {
110+
this.sandbox.stub(Date.prototype, 'toISOString').callsFake(function () {
111111
return ISOString
112112
})
113113

@@ -129,7 +129,7 @@ describe('The IncomingEdgeMetrics module', function () {
129129
}
130130
})
131131

132-
this.sandbox.stub(Date.prototype, 'toISOString', function () {
132+
this.sandbox.stub(Date.prototype, 'toISOString').callsFake(function () {
133133
return ISOString
134134
})
135135

lib/agent/metrics/rpm/index.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('The RpmMetrics module', function () {
1818
}
1919
})
2020

21-
this.sandbox.stub(Date.prototype, 'toISOString', function () {
21+
this.sandbox.stub(Date.prototype, 'toISOString').callsFake(function () {
2222
return ISOString
2323
})
2424

lib/agent/profiler/cpu/index.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ describe('The Cpu Profiler module', function () {
2424
id: 42
2525
}
2626

27-
var startProfilingStub = this.sandbox.stub(v8profiler, 'startProfiling', function () {})
28-
var stopProfilingStub = this.sandbox.stub(v8profiler, 'stopProfiling', function () {
27+
var startProfilingStub = this.sandbox.stub(v8profiler, 'startProfiling').callsFake(function () {})
28+
var stopProfilingStub = this.sandbox.stub(v8profiler, 'stopProfiling').callsFake(function () {
2929
return profile
3030
})
3131

@@ -38,7 +38,7 @@ describe('The Cpu Profiler module', function () {
3838

3939
profiler.profileWindow = 0
4040

41-
this.sandbox.stub(Date, 'now', function () {
41+
this.sandbox.stub(Date, 'now').callsFake(function () {
4242
return now
4343
})
4444

lib/agent/profiler/memory/index.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('The Memory Profiler module', function () {
2424
controlBus: msgBus
2525
})
2626

27-
this.sandbox.stub(v8profiler, 'takeSnapshot', function () {
27+
this.sandbox.stub(v8profiler, 'takeSnapshot').callsFake(function () {
2828
return {
2929
export: function (cb) {
3030
cb(null, snapshotContent)
@@ -33,7 +33,7 @@ describe('The Memory Profiler module', function () {
3333
}
3434
})
3535

36-
this.sandbox.stub(Date, 'now', function () {
36+
this.sandbox.stub(Date, 'now').callsFake(function () {
3737
return now
3838
})
3939

lib/agent/security/security.spec.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('The Security module', function () {
2424
sendDependencies: this.sandbox.spy()
2525
}
2626

27-
this.sandbox.stub(fs, 'readFile', function (file, callback) {
27+
this.sandbox.stub(fs, 'readFile').callsFake(function (file, callback) {
2828
if (file === '.snyk') {
2929
callback(null, new Buffer(
3030
'version: v9.9.9\n' +
@@ -39,7 +39,7 @@ describe('The Security module', function () {
3939
callback(new Error('not implemented'))
4040
})
4141

42-
this.sandbox.stub(childProcess, 'execFile', function (cmd, args, opts, callback) {
42+
this.sandbox.stub(childProcess, 'execFile').callsFake(function (cmd, args, opts, callback) {
4343
if (typeof opts === 'function') {
4444
callback = opts
4545
}
@@ -55,7 +55,7 @@ describe('The Security module', function () {
5555
callback(new Error('not implemented'))
5656
})
5757

58-
this.sandbox.stub(fs, 'readdir', function (dir, callback) {
58+
this.sandbox.stub(fs, 'readdir').callsFake(function (dir, callback) {
5959
if (dir === '/project/node_modules/vuln') {
6060
callback(null, [
6161
'package.json',
@@ -113,11 +113,11 @@ describe('The Security module', function () {
113113
sendDependencies: this.sandbox.spy()
114114
}
115115

116-
this.sandbox.stub(fs, 'readFile', function (file, callback) {
116+
this.sandbox.stub(fs, 'readFile').callsFake(function (file, callback) {
117117
callback(new Error('ENOENT'))
118118
})
119119

120-
this.sandbox.stub(childProcess, 'execFile', function (cmd, args, opts, callback) {
120+
this.sandbox.stub(childProcess, 'execFile').callsFake(function (cmd, args, opts, callback) {
121121
if (args.indexOf('--json') > -1) {
122122
callback(null, JSON.stringify({ dependencies: dependencies }))
123123
return
@@ -156,7 +156,7 @@ describe('The Security module', function () {
156156
sendDependencies: this.sandbox.spy()
157157
}
158158

159-
this.sandbox.stub(fs, 'readFile', function (file, callback) {
159+
this.sandbox.stub(fs, 'readFile').callsFake(function (file, callback) {
160160
if (file === '.snyk') {
161161
callback(null, new Buffer(
162162
'version: v9.9.9\n' +
@@ -168,7 +168,7 @@ describe('The Security module', function () {
168168
callback(new Error('not implemented'))
169169
})
170170

171-
this.sandbox.stub(childProcess, 'execFile', function (cmd, args, opts, callback) {
171+
this.sandbox.stub(childProcess, 'execFile').callsFake(function (cmd, args, opts, callback) {
172172
if (args.indexOf('--json') > -1) {
173173
callback(null, JSON.stringify({ dependencies: dependencies }))
174174
return
@@ -207,7 +207,7 @@ describe('The Security module', function () {
207207
sendDependencies: this.sandbox.spy()
208208
}
209209

210-
this.sandbox.stub(fs, 'readFile', function (file, callback) {
210+
this.sandbox.stub(fs, 'readFile').callsFake(function (file, callback) {
211211
if (file === '.snyk') {
212212
callback(null, new Buffer(
213213
'version: v9.9.9\n' +
@@ -219,7 +219,7 @@ describe('The Security module', function () {
219219
callback(new Error('not implemented'))
220220
})
221221

222-
this.sandbox.stub(childProcess, 'execFile', function (cmd, args, opts, callback) {
222+
this.sandbox.stub(childProcess, 'execFile').callsFake(function (cmd, args, opts, callback) {
223223
if (args.indexOf('--json') > -1) {
224224
callback(null, JSON.stringify({ dependencies: dependencies }))
225225
return

0 commit comments

Comments
 (0)