Skip to content

Commit

Permalink
presence test
Browse files Browse the repository at this point in the history
  • Loading branch information
skhugh committed Apr 5, 2024
1 parent 4aa9a04 commit ef58a7e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions yorkie/src/androidTest/kotlin/dev/yorkie/core/ClientTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,10 @@ class ClientTest {
assertIs<RemoteChange>(d2Events.first())
assertTreesXmlEquals("<doc><p>12</p><p>34</p></doc>", d1, d2)

// In push-only mode, remote-change events should not occur.
d2Events.clear()
c2.pauseRemoteChanges(d2)

d1.updateAsync { root, _ ->
root.rootTree().edit(2, 2, text { "a" })
}.await()
Expand All @@ -574,14 +578,12 @@ class ClientTest {
// but a response has not yet been received.
c2.syncAsync().await()

// In push-only mode, remote-change events should not occur.
d2Events.clear()
c2.pauseRemoteChanges(d2)

delay(100) // Keep the push-only state.
assertTrue(d2Events.none { it is RemoteChange })

c2.resumeRemoteChanges(d2)
delay(100)
assertTrue { d2Events.any { it is RemoteChange } }

d2.updateAsync { root, _ ->
root.rootTree().edit(2, 2, text { "b" })
Expand Down

0 comments on commit ef58a7e

Please sign in to comment.