Skip to content

Commit

Permalink
fix: sync test
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Meier <[email protected]>
  • Loading branch information
astromechza committed Oct 26, 2024
1 parent 57807fe commit 1a18ef6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func Test_sync3(t *testing.T) {
// Each peer also has a starting doc that has some existing content.
peerDoc := NewSharedDoc(automerge.New())
peerDocs = append(peerDocs, peerDoc)
assertEqual(t, peerDoc.Doc().RootMap().Set(fmt.Sprintf("peer-%d", i), "b"), nil)
assertEqual(t, peerDoc.Doc().RootMap().Set(fmt.Sprintf("peer-%d", i), int64(i)), nil)
_, _ = peerDoc.Doc().Commit("change")
go func() {
defer wg.Done()
Expand All @@ -70,5 +70,9 @@ func Test_sync3(t *testing.T) {
t.Log(LoggableChangeHashes(peerDocs[1].Doc().Heads()).LogValue().String())
assertEqual(t, sd.Doc().Heads(), peerDocs[0].Doc().Heads())
assertEqual(t, sd.Doc().Heads(), peerDocs[1].Doc().Heads())
assertEqual(t, sd.Doc().RootMap().GoString(), `&automerge.Map{"a": "b", "peer-0": "b", "peer-1": "b"}`)
assertEqual(t, sd.Doc().RootMap().Len(), 3)
values, _ := sd.Doc().RootMap().Values()
assertEqual(t, values["a"].Str(), "b")
assertEqual(t, values["peer-0"].Int64(), 0)
assertEqual(t, values["peer-1"].Int64(), 1)
}

0 comments on commit 1a18ef6

Please sign in to comment.