Skip to content

Commit

Permalink
Merge pull request #278 from automerge/fix-collection-synchronizer-te…
Browse files Browse the repository at this point in the history
…st-types

Fix types in CollectionSynchronizer tests
  • Loading branch information
pvh authored Jan 23, 2024
2 parents f4ce137 + 468affe commit 0db4adf
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 0db4adf

Please sign in to comment.