Skip to content

Commit d329c82

Browse files
author
cod1k
committed
Add test to ensure waitUntil is not wrapped twice
Introduced a new test case to validate that `makeFlushLock` does not wrap the execution context more than once. Ensures consistency and prevents potential redundancy in the flush handling logic.
1 parent fbfcc3b commit d329c82

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/cloudflare/test/flush.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ describe('Flush buffer test', () => {
1212
const { finalize } = makeFlushLock(mockExecutionContext);
1313
await expect(finalize()).resolves.toBeUndefined();
1414
});
15+
it('waitUntil should not be wrapped mose than once', () => {
16+
expect(makeFlushLock(mockExecutionContext), 'Execution context wrapped twice').toBe(
17+
makeFlushLock(mockExecutionContext),
18+
);
19+
});
1520
it('should flush buffer only after all waitUntil were finished', async () => {
1621
const { promise, resolve } = Promise.withResolvers();
1722
const lock = makeFlushLock(mockExecutionContext);

0 commit comments

Comments
 (0)