Skip to content

Commit

Permalink
🐛 Fix missing initialization of map
Browse files Browse the repository at this point in the history
  • Loading branch information
Bigomby committed Aug 10, 2016
1 parent acef863 commit 19f84a5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions types/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func NewMessage() *Message {
return &Message{
payload: lane.NewStack(),
Reports: lane.NewStack(),
Opts: make(map[string]interface{}),
}
}

Expand Down
13 changes: 13 additions & 0 deletions types/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ import (
)

func TestMessage(t *testing.T) {
Convey("Given a message", t, func() {

Convey("When fields are accessed", func() {
m := NewMessage()

Convey("Then fields has to be initialized", func() {
So(m.Opts, ShouldNotBeNil)
So(m.payload, ShouldNotBeNil)
So(m.Reports, ShouldNotBeNil)
})
})
})

Convey("Given a payload", t, func() {
payload := "This is the payload"

Expand Down

0 comments on commit 19f84a5

Please sign in to comment.