From 468affe36df3c48b41a1ad58853cc3fb18a59680 Mon Sep 17 00:00:00 2001 From: Herb Caudill Date: Mon, 22 Jan 2024 13:50:27 +0100 Subject: [PATCH] fix types in CollectionSynchronizer tests --- .../test/CollectionSynchronizer.test.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/automerge-repo/test/CollectionSynchronizer.test.ts b/packages/automerge-repo/test/CollectionSynchronizer.test.ts index fa3c31702..4b641e059 100644 --- a/packages/automerge-repo/test/CollectionSynchronizer.test.ts +++ b/packages/automerge-repo/test/CollectionSynchronizer.test.ts @@ -1,6 +1,6 @@ import assert from "assert" import { beforeEach, describe, it } from "vitest" -import { PeerId, Repo } from "../src/index.js" +import { PeerId, Repo, SyncMessage } from "../src/index.js" import { CollectionSynchronizer } from "../src/synchronizer/CollectionSynchronizer.js" describe("CollectionSynchronizer", () => { @@ -24,8 +24,9 @@ describe("CollectionSynchronizer", () => { synchronizer.addPeer("peer1" as PeerId) synchronizer.once("message", event => { - assert(event.targetId === "peer1") - assert(event.documentId === handle.documentId) + const { targetId, documentId } = event as SyncMessage + assert(targetId === "peer1") + assert(documentId === handle.documentId) done() }) @@ -37,8 +38,9 @@ describe("CollectionSynchronizer", () => { const handle = repo.create() synchronizer.addDocument(handle.documentId) synchronizer.once("message", event => { - assert(event.targetId === "peer1") - assert(event.documentId === handle.documentId) + const { targetId, documentId } = event as SyncMessage + assert(targetId === "peer1") + assert(documentId === handle.documentId) done() }) synchronizer.addPeer("peer1" as PeerId)