Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
chore: cast typescript in tests to workaround 1.3.0 compatiblity issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Amir Blum committed May 29, 2022
1 parent aeaa5e3 commit e880a4d
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 84 deletions.
2 changes: 1 addition & 1 deletion packages/instrumentation-express/test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@ export const errorMiddleware = (_req: express.Request, res: express.Response, ne
};

export const getExpressSpans = (): ReadableSpan[] => {
return getTestSpans().filter((s) => s.instrumentationLibrary.name?.endsWith('express'));
return getTestSpans().filter((s) => s.instrumentationLibrary.name?.endsWith('express')) as ReadableSpan[];
};
8 changes: 4 additions & 4 deletions packages/instrumentation-kafkajs/test/kafkajs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ describe('instrumentation-kafkajs', () => {
expect(span.attributes[SemanticAttributes.MESSAGING_DESTINATION]).toStrictEqual('topic-name-1');

expect(messagesSent.length).toBe(1);
expectKafkaHeadersToMatchSpanContext(messagesSent[0], span);
expectKafkaHeadersToMatchSpanContext(messagesSent[0], span as ReadableSpan);
});

it('send two messages', async () => {
Expand All @@ -148,8 +148,8 @@ describe('instrumentation-kafkajs', () => {
expect(spans[1].name).toStrictEqual('topic-name-1');

expect(messagesSent.length).toBe(2);
expectKafkaHeadersToMatchSpanContext(messagesSent[0], spans[0]);
expectKafkaHeadersToMatchSpanContext(messagesSent[1], spans[1]);
expectKafkaHeadersToMatchSpanContext(messagesSent[0], spans[0] as ReadableSpan);
expectKafkaHeadersToMatchSpanContext(messagesSent[1], spans[1] as ReadableSpan);
});

it('send batch', async () => {
Expand Down Expand Up @@ -185,7 +185,7 @@ describe('instrumentation-kafkajs', () => {

expect(messagesSent.length).toBe(3);
for (let i = 0; i < 3; i++) {
expectKafkaHeadersToMatchSpanContext(messagesSent[i], spans[i]);
expectKafkaHeadersToMatchSpanContext(messagesSent[i], spans[i] as ReadableSpan);
}
});
});
Expand Down
Loading

0 comments on commit e880a4d

Please sign in to comment.