SSE Session and examples

This commit is contained in:
2026-09-17 07:51:48 +00:00
committed by Kuldeep
parent e96ab6457b
commit 752cda0706
16 changed files with 2306 additions and 4 deletions
+9
View File
@@ -101,6 +101,9 @@ const testEventEmitterEmitContinuesAfterListenerThrows = (): void => {
const emitter = new EventEmitter<TestEvents>();
const secondListener = vi.fn();
// Spy on the console.error method
const consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
emitter.on('message', (): void => {
throw new Error('listener failure');
});
@@ -110,6 +113,12 @@ const testEventEmitterEmitContinuesAfterListenerThrows = (): void => {
expect(secondListener).toHaveBeenCalledOnce();
expect(secondListener).toHaveBeenCalledWith('hello');
expect(consoleErrorSpy).toHaveBeenCalledOnce();
expect(consoleErrorSpy).toHaveBeenCalledWith(new Error('listener failure'));
// Remove the mock on console.error
consoleErrorSpy.mockRestore();
};
/**