Improve test fixtures
This commit is contained in:
4
tests/fixtures/events.fixtures.ts
vendored
4
tests/fixtures/events.fixtures.ts
vendored
@@ -2,14 +2,14 @@ import type { SSEvent } from '../../src/types.js';
|
||||
|
||||
type EventFixture = {
|
||||
raw: string;
|
||||
parsed?: SSEvent[];
|
||||
parsed: SSEvent[];
|
||||
};
|
||||
|
||||
/** Combines all the raw strings into a single chunk and flattens the parsed arrays into a single array to simulate multi-event chunks. */
|
||||
const withCombinedChunk = (fixtures: EventFixture[]): EventFixture => {
|
||||
return {
|
||||
raw: fixtures.map(({ raw }) => raw).join(''),
|
||||
parsed: fixtures.flatMap(({ parsed }) => parsed ?? []),
|
||||
parsed: fixtures.flatMap(({ parsed }) => parsed),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user