fix(core): update

This commit is contained in:
2023-08-02 03:11:17 +02:00
parent 9e25494f8f
commit fcb67ec878
3 changed files with 101 additions and 4 deletions

View File

@ -59,4 +59,19 @@ tap.test('should delete documents not part of the piping session', async () => {
await testElasticDoc.endPipingSession();
});
tap.test('should take and store snapshot', async () => {
await testElasticDoc.takeSnapshot(async (iterator, prevSnapshot) => {
const aggregationData = [];
for await (const doc of iterator) {
// Sample aggregation: counting documents
aggregationData.push(doc);
}
const snapshot = {
date: new Date().toISOString(),
aggregationData,
};
return snapshot;
});
});
tap.start();