Skip to content

Commit

Permalink
Check the returned next_batch
Browse files Browse the repository at this point in the history
  • Loading branch information
kegsay committed Jun 4, 2024
1 parent 91a1a56 commit 17cb5f0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests-integration/extensions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package syncv3

import (
"encoding/json"
"fmt"
"testing"
"time"

Expand Down Expand Up @@ -467,6 +468,7 @@ func TestExtensionToDeviceSequence(t *testing.T) {
},
})

hiSince := "999999"
res := v3.mustDoV3Request(t, aliceToken, sync3.Request{
Lists: map[string]sync3.RequestList{"a": {
Ranges: sync3.SliceRanges{
Expand All @@ -476,11 +478,17 @@ func TestExtensionToDeviceSequence(t *testing.T) {
Extensions: extensions.Request{
ToDevice: &extensions.ToDeviceRequest{
Core: extensions.Core{Enabled: &boolTrue},
Since: "999999",
Since: hiSince,
},
},
})
m.MatchResponse(t, res, m.MatchList("a", m.MatchV3Count(0)), m.MatchToDeviceMessages(toDeviceMsgs))
m.MatchResponse(t, res, m.MatchList("a", m.MatchV3Count(0)), m.MatchToDeviceMessages(toDeviceMsgs), func(res *sync3.Response) error {
// ensure that we return a lower numbered since token
if res.Extensions.ToDevice.NextBatch == hiSince {
return fmt.Errorf("next_batch got %v wanted lower", hiSince)
}
return nil
})
}

// tests that the account data extension works:
Expand Down

0 comments on commit 17cb5f0

Please sign in to comment.