1
1
import { createProcessor } from "./message" ;
2
2
import type { Message } from "../types/message" ;
3
+ import { ReceivedStatusUpdate } from "@webxdc/types" ;
3
4
4
5
// a little helper to let us track messages for testing purposes
5
6
function track ( ) : [ ( ) => Message [ ] , ( message : Message ) => void ] {
@@ -19,7 +20,7 @@ test("distribute to self", () => {
19
20
const processor = createProcessor ( onMessage ) ;
20
21
const client0 = processor . createClient ( "3001" ) ;
21
22
22
- const client0Heard : UpdateDescr [ ] = [ ] ;
23
+ const client0Heard : ReceivedStatusUpdate < any > [ ] = [ ] ;
23
24
24
25
client0 . connect ( ( updates ) => {
25
26
client0Heard . push ( ...updates ) ;
@@ -58,8 +59,8 @@ test("distribute to self and other", () => {
58
59
const client0 = processor . createClient ( "3001" ) ;
59
60
const client1 = processor . createClient ( "3002" ) ;
60
61
61
- const client0Heard : UpdateDescr [ ] = [ ] ;
62
- const client1Heard : UpdateDescr [ ] = [ ] ;
62
+ const client0Heard : ReceivedStatusUpdate < any > [ ] = [ ] ;
63
+ const client1Heard : ReceivedStatusUpdate < any > [ ] = [ ] ;
63
64
64
65
client0 . connect ( ( updates ) => {
65
66
client0Heard . push ( ...updates ) ;
@@ -125,8 +126,8 @@ test("setUpdateListener serial should skip older", () => {
125
126
const client0 = processor . createClient ( "3001" ) ;
126
127
const client1 = processor . createClient ( "3002" ) ;
127
128
128
- const client0Heard : UpdateDescr [ ] = [ ] ;
129
- const client1Heard : UpdateDescr [ ] = [ ] ;
129
+ const client0Heard : ReceivedStatusUpdate < any > [ ] = [ ] ;
130
+ const client1Heard : ReceivedStatusUpdate < any > [ ] = [ ] ;
130
131
131
132
client0 . connect ( ( updates ) => {
132
133
client0Heard . push ( ...updates ) ;
@@ -155,8 +156,8 @@ test("other starts listening later", () => {
155
156
const client0 = processor . createClient ( "3001" ) ;
156
157
const client1 = processor . createClient ( "3002" ) ;
157
158
158
- const client0Heard : UpdateDescr [ ] = [ ] ;
159
- const client1Heard : UpdateDescr [ ] = [ ] ;
159
+ const client0Heard : ReceivedStatusUpdate < any > [ ] = [ ] ;
160
+ const client1Heard : ReceivedStatusUpdate < any > [ ] = [ ] ;
160
161
161
162
client0 . connect ( ( updates ) => {
162
163
client0Heard . push ( ...updates ) ;
@@ -229,8 +230,8 @@ test("client is created later and needs to catch up", () => {
229
230
const processor = createProcessor ( ) ;
230
231
const client0 = processor . createClient ( "3001" ) ;
231
232
232
- const client0Heard : UpdateDescr [ ] = [ ] ;
233
- const client1Heard : UpdateDescr [ ] = [ ] ;
233
+ const client0Heard : ReceivedStatusUpdate < any > [ ] = [ ] ;
234
+ const client1Heard : ReceivedStatusUpdate < any > [ ] = [ ] ;
234
235
235
236
client0 . connect ( ( updates ) => {
236
237
client0Heard . push ( ...updates ) ;
@@ -269,8 +270,8 @@ test("other starts listening later but is partially caught up", () => {
269
270
const client0 = processor . createClient ( "3001" ) ;
270
271
const client1 = processor . createClient ( "3002" ) ;
271
272
272
- const client0Heard : UpdateDescr [ ] = [ ] ;
273
- const client1Heard : UpdateDescr [ ] = [ ] ;
273
+ const client0Heard : ReceivedStatusUpdate < any > [ ] = [ ] ;
274
+ const client1Heard : ReceivedStatusUpdate < any > [ ] = [ ] ;
274
275
275
276
client0 . connect ( ( updates ) => {
276
277
client0Heard . push ( ...updates ) ;
@@ -456,8 +457,8 @@ test("connect with clear means we get no catchup if no new updates", () => {
456
457
const processor = createProcessor ( ) ;
457
458
const client0 = processor . createClient ( "3001" ) ;
458
459
459
- const client0Heard : ( UpdateDescr | string ) [ ] = [ ] ;
460
- const client1Heard : ( UpdateDescr | string ) [ ] = [ ] ;
460
+ const client0Heard : ( ReceivedStatusUpdate < any > | string ) [ ] = [ ] ;
461
+ const client1Heard : ( ReceivedStatusUpdate < any > | string ) [ ] = [ ] ;
461
462
462
463
client0 . connect (
463
464
( updates ) => {
@@ -514,8 +515,8 @@ test("connect with clear means catchup only with updates after clear", () => {
514
515
const processor = createProcessor ( onMessage ) ;
515
516
const client0 = processor . createClient ( "3001" ) ;
516
517
517
- const client0Heard : ( UpdateDescr | string ) [ ] = [ ] ;
518
- const client1Heard : ( UpdateDescr | string ) [ ] = [ ] ;
518
+ const client0Heard : ( ReceivedStatusUpdate < any > | string ) [ ] = [ ] ;
519
+ const client1Heard : ( ReceivedStatusUpdate < any > | string ) [ ] = [ ] ;
519
520
520
521
client0 . connect (
521
522
( updates ) => {
@@ -623,8 +624,8 @@ test("distribute to self and other, but other was disconnected", () => {
623
624
const client0 = processor . createClient ( "3001" ) ;
624
625
const client1 = processor . createClient ( "3002" ) ;
625
626
626
- const client0Heard : UpdateDescr [ ] = [ ] ;
627
- const client1Heard : UpdateDescr [ ] = [ ] ;
627
+ const client0Heard : ReceivedStatusUpdate < any > [ ] = [ ] ;
628
+ const client1Heard : ReceivedStatusUpdate < any > [ ] = [ ] ;
628
629
629
630
client0 . connect ( ( updates ) => {
630
631
client0Heard . push ( ...updates ) ;
0 commit comments