Skip to content

Commit 7643a8f

Browse files
author
Peter Marton
committed
test(instrumentation/https): cover with tests
1 parent cc0dd9a commit 7643a8f

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

Diff for: src/instrumentation/httpsClient.spec.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
'use strict'
2+
3+
const https = require('https')
4+
const { expect } = require('chai')
5+
const { Tracer } = require('opentracing')
6+
const instrumentation = require('./httpsClient')
7+
const httpClient = require('./httpClient')
8+
9+
describe('instrumentation: httpsClient', () => {
10+
let tracer
11+
12+
beforeEach(() => {
13+
tracer = new Tracer()
14+
})
15+
16+
describe('#patch', () => {
17+
it('should call httpClient\'s patch', function () {
18+
this.sandbox.stub(httpClient, 'patch')
19+
20+
instrumentation.patch(https, tracer)
21+
22+
expect(httpClient.patch).to.be.calledWith(https, tracer)
23+
})
24+
})
25+
26+
describe('#unpatch', () => {
27+
it('should call httpClient\'s unpatch', function () {
28+
this.sandbox.stub(httpClient, 'unpatch')
29+
30+
instrumentation.unpatch(https, tracer)
31+
32+
expect(httpClient.unpatch).to.be.calledWith(https)
33+
})
34+
})
35+
})

0 commit comments

Comments
 (0)