Skip to content

Commit

Permalink
fix types in CollectionSynchronizer tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HerbCaudill committed Jan 22, 2024
1 parent f4ce137 commit 468affe
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/automerge-repo/test/CollectionSynchronizer.test.ts
Original file line number Diff line number Diff line change
@@ -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", () => {
Expand All @@ -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()
})

Expand All @@ -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)
Expand Down

0 comments on commit 468affe

Please sign in to comment.