Skip to content

Commit

Permalink
388th Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Shyam-Chen committed Oct 16, 2024
1 parent 7d74517 commit 4ca9998
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"@playwright/test": "1.47.2",
"@types/node": "20.16.10",
"@types/ws": "8.5.12",
"fetch-event-stream": "0.1.5",
"ws": "8.18.0"
}
}
13 changes: 13 additions & 0 deletions e2e/src/sse.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { expect, test } from '@playwright/test';
import { events } from 'fetch-event-stream';

test('ES /api/sse', async ({ baseURL }) => {
const abortController = new AbortController();
const response = await fetch(`${baseURL}/api/sse`, { signal: abortController.signal });
const stream = events(response, abortController.signal);

for await (const event of stream) {
expect(event.data).toBe('Some message');
abortController.abort();
}
});
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4ca9998

Please sign in to comment.