Skip to content

Commit 2f04745

Browse files
committed
fix typo
1 parent cbff5d9 commit 2f04745

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/unit/harvester.test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const { EventEmitter } = require('node:events')
1111
const sinon = require('sinon')
1212

1313
const { match } = require('../lib/custom-assertions')
14+
const promiseResolvers = require('../lib/promise-resolvers')
1415
const Harvester = require('../../lib/harvester')
1516

1617
class FakeAggregator extends EventEmitter {
@@ -35,7 +36,7 @@ function createAggregator(sandbox, opts) {
3536
sandbox.stub(aggregator, 'start')
3637
sandbox.stub(aggregator, 'stop')
3738
sandbox.stub(aggregator, 'reconfigure')
38-
sandbox.stub(aggregator, 'send')
39+
sandbox.spy(aggregator, 'send')
3940
return aggregator
4041
}
4142

@@ -94,9 +95,12 @@ test('should reconfigure all aggregators', (t) => {
9495
})
9596

9697
test('resolve when all data is sent', async (t) => {
98+
const { promise, resolve } = promiseResolvers()
9799
const { aggregators, harvester } = t.nr
98100
await harvester.clear(() => {
99101
assert.equal(aggregators[0].send.callCount, 1, 'should call send on enabled aggregator')
100102
assert.equal(aggregators[1].send.callCount, 0, 'should not call send on disabled aggregator')
103+
resolve()
101104
})
105+
await promise
102106
})

0 commit comments

Comments
 (0)