lik/test/test.timedaggregator.both.ts

24 lines
667 B
TypeScript
Raw Normal View History

2019-08-02 14:32:52 +00:00
// import test framework
import { expect, tap } from '@pushrocks/tapbundle';
// import the module
2022-05-27 15:53:02 +00:00
import * as lik from '../ts/index.js';
2019-08-02 14:32:52 +00:00
let testTimedAggregator: lik.TimedAggregtor<string>;
2020-07-12 00:44:50 +00:00
tap.test('should create a timed aggregaotor', async (tools) => {
2019-08-02 14:32:52 +00:00
testTimedAggregator = new lik.TimedAggregtor<string>({
aggregationIntervalInMillis: 1000,
2020-07-12 00:44:50 +00:00
functionForAggregation: (aggregation) => {
2019-08-02 14:32:52 +00:00
console.log(aggregation);
2020-07-12 00:44:50 +00:00
},
2019-08-02 14:32:52 +00:00
});
testTimedAggregator.add('This');
testTimedAggregator.add('is a whole sentence.');
await tools.delayFor(1001);
testTimedAggregator.add('This one is another.');
await tools.delayFor(2000);
});
2023-11-09 20:17:13 +00:00
await tap.start();