Add publish tests

This commit is contained in:
Jon Staab
2025-03-27 14:23:09 -07:00
parent ca9eadf8ff
commit a91b22518e
3 changed files with 256 additions and 11 deletions
+4 -4
View File
@@ -58,6 +58,7 @@ export class Unicast extends (EventEmitter as new () => TypedEmitter<UnicastEven
if (isRelayOk(message)) {
const [_, id, ok, detail] = message
if (id !== this.options.event.id) return
if (ok) {
@@ -85,7 +86,7 @@ export class Unicast extends (EventEmitter as new () => TypedEmitter<UnicastEven
// Start asynchronously so the caller can set up listeners
yieldThread().then(() => {
this._adapter.send([ClientMessageType.Event, event])
this._adapter.send([ClientMessageType.Event, this.options.event])
})
}
@@ -159,6 +160,7 @@ export class Multicast extends (EventEmitter as new () => TypedEmitter<Multicast
if (this._completed.size === relays.length) {
this.emit(PublishEventType.Complete)
this.cleanup()
}
})
@@ -173,9 +175,7 @@ export class Multicast extends (EventEmitter as new () => TypedEmitter<Multicast
}
cleanup() {
for (const child of this._children) {
child.cleanup()
}
this.removeAllListeners()
}
}