Skip to content

Commit f1635e0

Browse files
committed
update types
1 parent 02700e8 commit f1635e0

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

backend/message.test.ts

+18-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { createProcessor } from "./message";
22
import type { Message } from "../types/message";
3+
import { ReceivedStatusUpdate } from "@webxdc/types";
34

45
// a little helper to let us track messages for testing purposes
56
function track(): [() => Message[], (message: Message) => void] {
@@ -19,7 +20,7 @@ test("distribute to self", () => {
1920
const processor = createProcessor(onMessage);
2021
const client0 = processor.createClient("3001");
2122

22-
const client0Heard: UpdateDescr[] = [];
23+
const client0Heard: ReceivedStatusUpdate<any>[] = [];
2324

2425
client0.connect((updates) => {
2526
client0Heard.push(...updates);
@@ -58,8 +59,8 @@ test("distribute to self and other", () => {
5859
const client0 = processor.createClient("3001");
5960
const client1 = processor.createClient("3002");
6061

61-
const client0Heard: UpdateDescr[] = [];
62-
const client1Heard: UpdateDescr[] = [];
62+
const client0Heard: ReceivedStatusUpdate<any>[] = [];
63+
const client1Heard: ReceivedStatusUpdate<any>[] = [];
6364

6465
client0.connect((updates) => {
6566
client0Heard.push(...updates);
@@ -125,8 +126,8 @@ test("setUpdateListener serial should skip older", () => {
125126
const client0 = processor.createClient("3001");
126127
const client1 = processor.createClient("3002");
127128

128-
const client0Heard: UpdateDescr[] = [];
129-
const client1Heard: UpdateDescr[] = [];
129+
const client0Heard: ReceivedStatusUpdate<any>[] = [];
130+
const client1Heard: ReceivedStatusUpdate<any>[] = [];
130131

131132
client0.connect((updates) => {
132133
client0Heard.push(...updates);
@@ -155,8 +156,8 @@ test("other starts listening later", () => {
155156
const client0 = processor.createClient("3001");
156157
const client1 = processor.createClient("3002");
157158

158-
const client0Heard: UpdateDescr[] = [];
159-
const client1Heard: UpdateDescr[] = [];
159+
const client0Heard: ReceivedStatusUpdate<any>[] = [];
160+
const client1Heard: ReceivedStatusUpdate<any>[] = [];
160161

161162
client0.connect((updates) => {
162163
client0Heard.push(...updates);
@@ -229,8 +230,8 @@ test("client is created later and needs to catch up", () => {
229230
const processor = createProcessor();
230231
const client0 = processor.createClient("3001");
231232

232-
const client0Heard: UpdateDescr[] = [];
233-
const client1Heard: UpdateDescr[] = [];
233+
const client0Heard: ReceivedStatusUpdate<any>[] = [];
234+
const client1Heard: ReceivedStatusUpdate<any>[] = [];
234235

235236
client0.connect((updates) => {
236237
client0Heard.push(...updates);
@@ -269,8 +270,8 @@ test("other starts listening later but is partially caught up", () => {
269270
const client0 = processor.createClient("3001");
270271
const client1 = processor.createClient("3002");
271272

272-
const client0Heard: UpdateDescr[] = [];
273-
const client1Heard: UpdateDescr[] = [];
273+
const client0Heard: ReceivedStatusUpdate<any>[] = [];
274+
const client1Heard: ReceivedStatusUpdate<any>[] = [];
274275

275276
client0.connect((updates) => {
276277
client0Heard.push(...updates);
@@ -456,8 +457,8 @@ test("connect with clear means we get no catchup if no new updates", () => {
456457
const processor = createProcessor();
457458
const client0 = processor.createClient("3001");
458459

459-
const client0Heard: (UpdateDescr | string)[] = [];
460-
const client1Heard: (UpdateDescr | string)[] = [];
460+
const client0Heard: (ReceivedStatusUpdate<any> | string)[] = [];
461+
const client1Heard: (ReceivedStatusUpdate<any> | string)[] = [];
461462

462463
client0.connect(
463464
(updates) => {
@@ -514,8 +515,8 @@ test("connect with clear means catchup only with updates after clear", () => {
514515
const processor = createProcessor(onMessage);
515516
const client0 = processor.createClient("3001");
516517

517-
const client0Heard: (UpdateDescr | string)[] = [];
518-
const client1Heard: (UpdateDescr | string)[] = [];
518+
const client0Heard: (ReceivedStatusUpdate<any> | string)[] = [];
519+
const client1Heard: (ReceivedStatusUpdate<any> | string)[] = [];
519520

520521
client0.connect(
521522
(updates) => {
@@ -623,8 +624,8 @@ test("distribute to self and other, but other was disconnected", () => {
623624
const client0 = processor.createClient("3001");
624625
const client1 = processor.createClient("3002");
625626

626-
const client0Heard: UpdateDescr[] = [];
627-
const client1Heard: UpdateDescr[] = [];
627+
const client0Heard: ReceivedStatusUpdate<any>[] = [];
628+
const client1Heard: ReceivedStatusUpdate<any>[] = [];
628629

629630
client0.connect((updates) => {
630631
client0Heard.push(...updates);

0 commit comments

Comments
 (0)