2.3 KiB
2.3 KiB
id, name, status, depends_on, scope, risk, impact, level
| id | name | status | depends_on | scope | risk | impact | level |
|---|---|---|---|---|---|---|---|
| core-operators-tests | Write tests for all stream operators | completed | moderate | low | component | implementation |
Description
The operators.ts module exports 13 operators (filter, map, pipe, take, reduce, toArray, batch, dedupe, window, flat, groupBy, chain, join). None have tests. Each operator works with AsyncIterable input; Repeater-returning operators (filter, map) provide backpressure-aware push semantics.
The operators are adapted from graphql-yoga (filter, map, pipe) and added from the async-utility reference (take, reduce, toArray, batch, dedupe, window, flat, groupBy, chain, join).
Acceptance Criteria
test/operators.test.tsexists and passesfilter— filters items by predicate; type-narrowing overload worksfilter— async predicate supportmap— transforms items; async mapper supportpipe— composes 1-5 functionspipe— compose withsubscribe:pipe(pubsub.subscribe("myEvent", id), filter(...), map(...))take— yields first N items, then stopsreduce— reduces to single valuetoArray— collects all items into arraybatch— groups into arrays ofsizebatch— yields remaining items if not a full batchdedupe— yields only unique itemswindow— sliding window ofsizeitems, advancing bystepflat— flattensAsyncIterable<T[]>intoAsyncIterable<T>groupBy— groups items by key intoMap(terminal operation)chain— concatenates multiple async iterablesjoin— streaming join between two sources on matching keys
References
- docs/architecture/api-surface.md (Operators section)
- src/operators.ts
Notes
To be filled by implementation agent
Summary
Implemented comprehensive tests for all 13 stream operators.
- Created:
test/operators.test.ts(53 tests) - Tests cover: filter (5 tests including type-narrowing & async), map (3 tests including async), pipe (6 tests including compose with subscribe), take (4), reduce (4), toArray (3), batch (5), dedupe (4), window (5), flat (3), groupBy (3), chain (4), join (4)
- All 53 tests passing, build and lint pass