Skip to content

Commit

Permalink
Cover all priorities in span_context.spec.js.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenh committed Aug 13, 2018
1 parent 30cf106 commit 448813b
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions test/opentracing/span_context.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,22 @@ describe('SpanContext', () => {
})

it('should recognize sampling priority', () => {
const props = {
traceId: '123',
spanId: '456',
parentId: '789',
samplingPriority: 0,
sampled: false,
baggageItems: { foo: 'bar' },
trace: {
started: ['span1', 'span2'],
finished: ['span1']
const priorities = [-1, 0, 1, 2];
priorities.forEach(p => {
const props = {
traceId: '123',
spanId: '456',
parentId: '789',
samplingPriority: p,
sampled: true,
baggageItems: { foo: 'bar' },
trace: {
started: ['span1', 'span2'],
finished: ['span1']
}
}
}
const spanContext = new SpanContext(props)

expect(spanContext).to.deep.equal(props)
const spanContext = new SpanContext(props)
expect(spanContext).to.deep.equal(props)
})
})
})

0 comments on commit 448813b

Please sign in to comment.