Skip to content

Commit

Permalink
Add a test when you try to add an existing message in the buffer (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
rstefan1 committed May 7, 2019
1 parent d50f396 commit a5a376d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/internal/buffer/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,21 @@ var _ = Describe("MessageBuffer interface", func() {
Expect(msgBuffer.Messages).To(HaveLen(1))
expectProperMessage(msgBuffer.Messages[0], msgID, msgMsg, msgGossipCount)
})

It("doesn't add the message if it already exists in buffer", func() {
msg := Message{
ID: msgID,
Msg: msgMsg,
GossipCount: msgGossipCount,
}
msgBuffer := NewMessageBuffer()
msgBuffer.Messages = append(msgBuffer.Messages, msg)

// try to add same message in buffer
msgBuffer.AddMessage(msg)
Expect(msgBuffer.Messages).To(HaveLen(1))
expectProperMessage(msgBuffer.Messages[0], msgID, msgMsg, msgGossipCount)
})
})

Describe("at DigestBuffer fuction call", func() {
Expand Down

0 comments on commit a5a376d

Please sign in to comment.