MCPcopy
hub / github.com/Effect-TS/effect / testSplitLines

Function testSplitLines

packages/effect/test/Stream/splitting.test.ts:18–29  ·  view source on GitHub ↗
(
  input: ReadonlyArray<Chunk.Chunk<string>>
)

Source from the content-addressed store, hash-verified

16})
17
18const testSplitLines = (
19 input: ReadonlyArray<Chunk.Chunk<string>>
20): Effect.Effect<readonly [ReadonlyArray<string>, ReadonlyArray<string>]> => {
21 const str = input.flatMap((chunk) => Chunk.toReadonlyArray(chunk).join("")).join("")
22 const expected = str.split(/\r?\n/)
23 return pipe(
24 Stream.fromChunks(...input),
25 Stream.splitLines,
26 Stream.runCollect,
27 Effect.map((chunk) => [expected, Chunk.toReadonlyArray(chunk)] as const)
28 )
29}
30
31describe("Stream", () => {
32 it.effect("split - should split properly", () =>

Callers 1

splitting.test.tsFile · 0.85

Calls 4

splitMethod · 0.80
joinMethod · 0.65
mapMethod · 0.65
pipeFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…