Skip to content

Commit

Permalink
style(opentelemetry-plugin-xml-http-request): ran lint:fix
Browse files Browse the repository at this point in the history
  • Loading branch information
thgao committed Jun 18, 2020
1 parent c7f8d33 commit 595ee85
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions packages/opentelemetry-plugin-xml-http-request/test/xhr.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,12 @@ describe('xhr', () => {

spyEntries = sandbox.stub(performance, 'getEntriesByType');
spyEntries.withArgs('resource').returns(resources);
xmlHttpRequestPlugin = new XMLHttpRequestPlugin(propagateTraceHeaderCorsUrls);
xmlHttpRequestPlugin = new XMLHttpRequestPlugin(
propagateTraceHeaderCorsUrls
);
webTracerProviderWithZone = new WebTracerProvider({
logLevel: LogLevel.ERROR,
plugins: [
xmlHttpRequestPlugin,
],
plugins: [xmlHttpRequestPlugin],
});
webTracerWithZone = webTracerProviderWithZone.getTracer('xhr-test');
dummySpanExporter = new DummySpanExporter();
Expand Down Expand Up @@ -226,16 +226,20 @@ describe('xhr', () => {
});

it('should patch to wrap XML HTTP Requests when enabled', () => {
let xhttp = new XMLHttpRequest();
const xhttp = new XMLHttpRequest();
assert.ok(isWrapped(xhttp.send));
xmlHttpRequestPlugin.enable(XMLHttpRequest.prototype, new api.NoopTracerProvider(), new NoopLogger());
xmlHttpRequestPlugin.enable(
XMLHttpRequest.prototype,
new api.NoopTracerProvider(),
new NoopLogger()
);
assert.ok(isWrapped(xhttp.send));
});

it('should unpatch to unwrap XML HTTP Requests when disabled', () => {
let xhttp = new XMLHttpRequest();
const xhttp = new XMLHttpRequest();
assert.ok(isWrapped(xhttp.send));
xmlHttpRequestPlugin.disable()
xmlHttpRequestPlugin.disable();
assert.ok(!isWrapped(xhttp.send));
});

Expand Down Expand Up @@ -374,7 +378,6 @@ describe('xhr', () => {
);

assert.strictEqual(events.length, 12, 'number of events is wrong');

});

it('should create a span for preflight request', () => {
Expand All @@ -386,7 +389,7 @@ describe('xhr', () => {
'parent span is not root span'
);
});

it('preflight request span should have correct name', () => {
const span: tracing.ReadableSpan = exportSpy.args[0][0][0];
assert.strictEqual(
Expand All @@ -395,7 +398,7 @@ describe('xhr', () => {
'preflight request span has wrong name'
);
});

it('preflight request span should have correct kind', () => {
const span: tracing.ReadableSpan = exportSpy.args[0][0][0];
assert.strictEqual(
Expand All @@ -404,12 +407,12 @@ describe('xhr', () => {
'span has wrong kind'
);
});

it('preflight request span should have correct events', () => {
const span: tracing.ReadableSpan = exportSpy.args[0][0][0];
const events = span.events;
assert.strictEqual(events.length, 9, 'number of events is wrong');

assert.strictEqual(
events[0].name,
PTN.FETCH_START,
Expand Down Expand Up @@ -463,7 +466,7 @@ describe('xhr', () => {
const propagateTraceHeaderCorsUrls = [url];
prepareData(done, url, { propagateTraceHeaderCorsUrls });
});

it('should set trace headers', () => {
const span: api.Span = exportSpy.args[1][0][0];
assert.strictEqual(
Expand Down

0 comments on commit 595ee85

Please sign in to comment.