Skip to content
Snippets Groups Projects
Commit 98cf69a0 authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

add a test to make sure uuids are working

parent 0aa974cc
No related branches found
No related tags found
2 merge requests!60Revert "Fail a test to be sure it works",!8Updates to match the client fullyDecentrilizedChannels branch
...@@ -122,3 +122,38 @@ func TestWasmModel_JoinChannel_LeaveChannel(t *testing.T) { ...@@ -122,3 +122,38 @@ func TestWasmModel_JoinChannel_LeaveChannel(t *testing.T) {
t.Fatalf("Expected 1 channels to exist") t.Fatalf("Expected 1 channels to exist")
} }
} }
// Test wasmModel.UpdateSentStatus happy path and ensure fields don't change.
func TestWasmModel_UUIDTest(t *testing.T) {
testString := "test"
testMsgId := channel.MakeMessageID([]byte(testString))
eventModel, err := newWasmModel(testString)
if err != nil {
t.Fatalf("%+v", err)
}
cid := channel.Identity{}
uuids := make([]uint64, 10)
for i := 0; i < 10; i++ {
// Store a test message
testMsg := buildMessage([]byte(testString), testMsgId.Bytes(),
nil, testString, testString, cid, time.Now(),
time.Second, channels.Sent)
uuid, err := eventModel.receiveHelper(testMsg)
if err != nil {
t.Fatalf("%+v", err)
}
uuids[i] = uuid
}
for i := 0; i < 10; i++ {
for j := i + 1; j < 10; j++ {
if uuids[i] == uuids[j] {
t.Fatalf("uuid failed: %d[%d] == %d[%d]",
uuids[i], i, uuids[j], j)
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment