diff --git a/indexedDb/implementation_test.go b/indexedDb/implementation_test.go index 12e9358aebdb4d2f228b679341bc1629e73c7a3e..61c550330aa47fbd603d7dc0adf2a7f7c5a9c268 100644 --- a/indexedDb/implementation_test.go +++ b/indexedDb/implementation_test.go @@ -229,16 +229,17 @@ func TestWasmModel_deleteMsgByChannel(t *testing.T) { // Store some test messages cid := channel.Identity{} - for i := 0; i < expectedMessages; i++ { - testStr := testString + strconv.Itoa(i) - testMsgId := channel.MakeMessageID([]byte(testStr), &id.ID{1}) - eventModel.ReceiveMessage(deleteChannel, testMsgId, testStr, - testStr, cid, time.Now(), time.Second, rounds.Round{ID: id.Round(0)}, 0, channels.Sent) - } - for i := expectedMessages; i < totalMessages; i++ { + for i := 0; i < totalMessages; i++ { testStr := testString + strconv.Itoa(i) + + // Interleave the channel id to ensure cursor is behaving intelligently + thisChannel := deleteChannel + if i%2 == 0 { + thisChannel = keepChannel + } + testMsgId := channel.MakeMessageID([]byte(testStr), &id.ID{1}) - eventModel.ReceiveMessage(keepChannel, testMsgId, testStr, + eventModel.ReceiveMessage(thisChannel, testMsgId, testStr, testStr, cid, time.Now(), time.Second, rounds.Round{ID: id.Round(0)}, 0, channels.Sent) }