@@ -60,14 +60,14 @@ func TestPresence(t *testing.T) {
6060 }))
6161 encoded , err := gojson .Marshal (d1 .AllPresences ())
6262 assert .NoError (t , err )
63- assert .Equal (t , fmt .Sprintf (`{"%s":{ "updated": "true"} }` , c1 .ID ()), string (encoded ))
63+ assert .Equal (t , fmt .Sprintf (`{"%s":[ "updated", "true"] }` , c1 .ID ()), string (encoded ))
6464
6565 // 03 Sync documents and check that the presence is updated on the other client
6666 assert .NoError (t , c1 .Sync (ctx ))
6767 assert .NoError (t , c2 .Sync (ctx ))
6868 encoded , err = gojson .Marshal (d2 .AllPresences ())
6969 assert .NoError (t , err )
70- assert .Equal (t , fmt .Sprintf (`{"%s":{ "updated": "true"} ,"%s":{} }` , c1 .ID (), c2 .ID ()), string (encoded ))
70+ assert .Equal (t , fmt .Sprintf (`{"%s":[ "updated", "true"] ,"%s":[] }` , c1 .ID (), c2 .ID ()), string (encoded ))
7171 })
7272
7373 t .Run ("presence with snapshot test" , func (t * testing.T ) {
@@ -90,36 +90,36 @@ func TestPresence(t *testing.T) {
9090 }
9191 encoded , err := gojson .Marshal (d1 .AllPresences ())
9292 assert .NoError (t , err )
93- assert .Equal (t , fmt .Sprintf (`{"%s":{ "updated": "9"} }` , c1 .ID ()), string (encoded ))
93+ assert .Equal (t , fmt .Sprintf (`{"%s":[ "updated", "9"] }` , c1 .ID ()), string (encoded ))
9494
9595 // 03 Sync documents and check that the presence is updated on the other client
9696 assert .NoError (t , c1 .Sync (ctx ))
9797 assert .NoError (t , c2 .Sync (ctx ))
9898 encoded , err = gojson .Marshal (d2 .AllPresences ())
9999 assert .NoError (t , err )
100- assert .Equal (t , fmt .Sprintf (`{"%s":{ "updated": "9"} ,"%s":{} }` , c1 .ID (), c2 .ID ()), string (encoded ))
100+ assert .Equal (t , fmt .Sprintf (`{"%s":[ "updated", "9"] ,"%s":[] }` , c1 .ID (), c2 .ID ()), string (encoded ))
101101 })
102102
103103 t .Run ("presence with attach and detach test" , func (t * testing.T ) {
104104 // 01. Create a document and attach it to the clients
105105 ctx := context .Background ()
106106 d1 := document .New (helper .TestDocKey (t ))
107- assert .NoError (t , c1 .Attach (ctx , d1 , client .WithPresence (innerpresence.Presence {"key" : c1 .Key ()})))
107+ assert .NoError (t , c1 .Attach (ctx , d1 , client .WithPresence (innerpresence.Presence {"key" , c1 .Key ()})))
108108 d2 := document .New (helper .TestDocKey (t ))
109- assert .NoError (t , c2 .Attach (ctx , d2 , client .WithPresence (innerpresence.Presence {"key" : c2 .Key ()})))
109+ assert .NoError (t , c2 .Attach (ctx , d2 , client .WithPresence (innerpresence.Presence {"key" , c2 .Key ()})))
110110 defer func () { assert .NoError (t , c2 .Detach (ctx , d2 )) }()
111111
112112 // 02. Check that the presence is updated on the other client.
113113 assert .NoError (t , c1 .Sync (ctx ))
114- assert .Equal (t , innerpresence.Presence {"key" : c1 .Key ()}, d1 .MyPresence ())
115- assert .Equal (t , innerpresence.Presence {"key" : c2 .Key ()}, d1 .PresenceForTest (c2 .ID ().String ()))
116- assert .Equal (t , innerpresence.Presence {"key" : c2 .Key ()}, d2 .MyPresence ())
117- assert .Equal (t , innerpresence.Presence {"key" : c1 .Key ()}, d2 .PresenceForTest (c1 .ID ().String ()))
114+ assert .Equal (t , innerpresence.Presence {"key" , c1 .Key ()}, d1 .MyPresence ())
115+ assert .Equal (t , innerpresence.Presence {"key" , c2 .Key ()}, d1 .PresenceForTest (c2 .ID ().String ()))
116+ assert .Equal (t , innerpresence.Presence {"key" , c2 .Key ()}, d2 .MyPresence ())
117+ assert .Equal (t , innerpresence.Presence {"key" , c1 .Key ()}, d2 .PresenceForTest (c1 .ID ().String ()))
118118
119119 // 03. The first client detaches the document and check that the presence is updated on the other client.
120120 assert .NoError (t , c1 .Detach (ctx , d1 ))
121121 assert .NoError (t , c2 .Sync (ctx ))
122- assert .Equal (t , innerpresence.Presence {"key" : c2 .Key ()}, d2 .MyPresence ())
122+ assert .Equal (t , innerpresence.Presence {"key" , c2 .Key ()}, d2 .MyPresence ())
123123 assert .Nil (t , d2 .PresenceForTest (c1 .ID ().String ()))
124124 })
125125
@@ -559,7 +559,7 @@ func TestPresence(t *testing.T) {
559559 expected = append (expected , watchResponsePair {
560560 Type : client .DocumentWatched ,
561561 Presences : map [string ]innerpresence.Presence {
562- c2 .ID ().String (): {"updated" : "true" },
562+ c2 .ID ().String (): {"updated" , "true" },
563563 },
564564 })
565565 err = d2 .Update (func (root * json.Object , p * presence.Presence ) error {
0 commit comments