Skip to content

Commit

Permalink
update var naming
Browse files Browse the repository at this point in the history
  • Loading branch information
jj22ee committed Jan 9, 2025
1 parent 88b0991 commit 3108fd3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/core/test/unit/middleware/mw_utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ describe('Middleware utils', function() {
});

describe('#resolveSampling', function() {
var res, sandbox, segment, responseHeader, shouldSampleStub;
var res, sandbox, segment, responseHeaders, shouldSampleStub;

beforeEach(function() {
sandbox = sinon.createSandbox();
Expand All @@ -157,22 +157,22 @@ describe('Middleware utils', function() {
shouldSampleStub = sandbox.stub(MWUtils.sampler, 'shouldSample').returns(true);

segment = {};
responseHeader = {};
responseHeaders = {};
res = {
req: {
headers: { host: 'moop.hello.com' },
url: '/evergreen',
method: 'GET',
},
header: (headerKey, headerValue) => {
responseHeader[headerKey] = headerValue;
responseHeaders[headerKey] = headerValue;
}
};
});

afterEach(function() {
sandbox.restore();
responseHeader = {};
responseHeaders = {};
});

it('should not mark segment as not traced if the sampled header is set to "1"', function() {
Expand Down Expand Up @@ -212,7 +212,7 @@ describe('Middleware utils', function() {
MWUtils.resolveSampling(headers, segment, res);

var expected = new RegExp('^Root=' + traceId + ';Sampled=1$');
assert.match(responseHeader[XRAY_HEADER], expected);
assert.match(responseHeaders[XRAY_HEADER], expected);
});

it('should mark segment as not traced if the sampling rules check returns false', function() {
Expand Down Expand Up @@ -271,13 +271,13 @@ describe('Middleware utils', function() {
method: 'GET',
};
var segment;
var responseHeader = {};
var responseHeaders = {};

var res = {
req: req,
on: (name, callback) => {},
header: (headerKey, headerValue) => {
responseHeader[headerKey] = headerValue;
responseHeaders[headerKey] = headerValue;
}
};
shouldSampleStub.returns(false);
Expand All @@ -288,7 +288,7 @@ describe('Middleware utils', function() {
}
);
assert.equal(segment.notTraced, true);
assert.equal(responseHeader[XRAY_HEADER], 'Root=' + traceId + ';Sampled=0');
assert.equal(responseHeaders[XRAY_HEADER], 'Root=' + traceId + ';Sampled=0');
});
});

Expand Down

0 comments on commit 3108fd3

Please sign in to comment.