Skip to content

Commit

Permalink
add reset function test for InMemorySpanExporter (#5107)
Browse files Browse the repository at this point in the history
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
  • Loading branch information
paper2 and pichlermarc authored Nov 5, 2024
1 parent 67d7718 commit 33dbde1
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,21 @@ describe('InMemorySpanExporter', () => {
});
});

it('should reset spans when reset is called', () => {
const root = provider.getTracer('default').startSpan('root');

provider
.getTracer('default')
.startSpan('child', {}, trace.setSpan(context.active(), root))
.end();
root.end();
assert.strictEqual(memoryExporter.getFinishedSpans().length, 2);

memoryExporter.reset();

assert.strictEqual(memoryExporter.getFinishedSpans().length, 0);
});

it('should return the success result', () => {
const exporter = new InMemorySpanExporter();
exporter.export([], (result: ExportResult) => {
Expand Down

0 comments on commit 33dbde1

Please sign in to comment.