From 7ea0b711db377c9a67933233fd20b76130ccc3da Mon Sep 17 00:00:00 2001 From: Kegan Dougal <7190048+kegsay@users.noreply.github.com> Date: Tue, 4 Jun 2024 17:22:43 +0100 Subject: [PATCH] Check for lower --- tests-integration/extensions_test.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests-integration/extensions_test.go b/tests-integration/extensions_test.go index d615906..26a5480 100644 --- a/tests-integration/extensions_test.go +++ b/tests-integration/extensions_test.go @@ -3,6 +3,7 @@ package syncv3 import ( "encoding/json" "fmt" + "strconv" "testing" "time" @@ -468,7 +469,7 @@ func TestExtensionToDeviceSequence(t *testing.T) { }, }) - hiSince := "999999" + hiSince := 999999 res := v3.mustDoV3Request(t, aliceToken, sync3.Request{ Lists: map[string]sync3.RequestList{"a": { Ranges: sync3.SliceRanges{ @@ -478,14 +479,18 @@ func TestExtensionToDeviceSequence(t *testing.T) { Extensions: extensions.Request{ ToDevice: &extensions.ToDeviceRequest{ Core: extensions.Core{Enabled: &boolTrue}, - Since: hiSince, + Since: fmt.Sprintf("%d", hiSince), }, }, }) 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) + got, err := strconv.Atoi(res.Extensions.ToDevice.NextBatch) + if err != nil { + return err + } + if got >= hiSince { + return fmt.Errorf("next_batch got %v wanted lower than %v", got, hiSince) } return nil })