Decompose architecture into atomic, dependency-ordered tasks
19 tasks covering core testing, Redis hardening, WebSocket client/server adapters, Worker adapter, and final review gates. Iroh adapters are tracked as a deferred placeholder blocked on the @alkdev/iroh fork. Phases: core validation → Redis hardening → review gate → WebSocket adapters → review gate → Worker adapter → review gate → final validation.
This commit is contained in:
46
tasks/013-worker-adapter-tests.md
Normal file
46
tasks/013-worker-adapter-tests.md
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
id: worker-adapter-tests
|
||||
name: Write tests for Worker event target adapter
|
||||
status: pending
|
||||
depends_on: [worker-adapter-implementation]
|
||||
scope: moderate
|
||||
risk: medium
|
||||
impact: component
|
||||
level: implementation
|
||||
---
|
||||
|
||||
## Description
|
||||
|
||||
Write tests for the Worker event target adapter(s). Testing Workers is non-trivial because it requires creating actual Worker instances or mocking the `postMessage`/`onmessage` API.
|
||||
|
||||
Test scenarios from the architecture doc:
|
||||
1. Main → Worker send — dispatchEvent from main posts message to worker
|
||||
2. Worker → Main send — dispatchEvent from worker posts message to main
|
||||
3. Bidirectional — both sides can subscribe and publish
|
||||
4. Topic scoping — type:id topics correctly formed
|
||||
5. Envelope round-trip — full envelope survives serialization
|
||||
6. Worker termination — cleanup when worker exits
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] `test/event-target-worker.test.ts` exists and passes
|
||||
- [ ] Mock strategy for Worker environment established (actual workers, vitest worker threads, or mocked postMessage)
|
||||
- [ ] Test: host dispatchEvent posts message to worker via postMessage
|
||||
- [ ] Test: worker thread dispatchEvent posts message to parent
|
||||
- [ ] Test: bidirectional communication works
|
||||
- [ ] Test: type:id topic scoping works correctly
|
||||
- [ ] Test: EventEnvelope round-trips through serialization
|
||||
- [ ] Test: addEventListener and removeEventListener work on both sides
|
||||
|
||||
## References
|
||||
|
||||
- docs/architecture/event-targets/worker.md (Test Plan section)
|
||||
- src/event-target-worker.ts
|
||||
|
||||
## Notes
|
||||
|
||||
> To be filled by implementation agent
|
||||
|
||||
## Summary
|
||||
|
||||
> To be filled on completion
|
||||
Reference in New Issue
Block a user