diff --git a/chatState.go b/chatState.go index e90542d..8ec3597 100644 --- a/chatState.go +++ b/chatState.go @@ -19,11 +19,13 @@ type chatState struct { Name string `json:"Name"` //state name Expire int32 `json:"Expire"` //unix timestamp when this state expire Send struct { //anything we need to send? + Sent bool `json:"Sent"` //whether the message has been sent or not Type string `json:"Type"` //what type of message Message map[string]string `json:"Message"` //the message to be sent,key value pair to describe the message } `json:"Send"` Receive struct { //anything we expect to receive + Received bool `json:"Received"` //whether the expected message has been received or not Validator string `json:"Validator"` Hint string `json:"Hint"` Message map[string]string `json:"Message"` //the description for receiving message diff --git a/chatState_test.go b/chatState_test.go index 24d4185..2f8d895 100644 --- a/chatState_test.go +++ b/chatState_test.go @@ -14,7 +14,9 @@ func TestChatState(t *testing.T) { "txt": "What is your date of birth?", "icon": "/mnt/data/abc.jpg"} s.Send.Type = "text" + s.Send.Sent = false s.Receive.Hint = "hint" + s.Receive.Received = false s.Receive.Validator = "validator email" s.Receive.Message = map[string]string{ "rtxt": "should be 3 chars at least", @@ -31,6 +33,8 @@ func TestChatState(t *testing.T) { AssertEqual(t, m.Name, n.Name, "Name should be equal") AssertEqual(t, m.Expire, n.Expire, "Expire should be equal") AssertEqual(t, m.Send.Type, n.Send.Type, "Send.Type should be equal") + AssertEqual(t, m.Receive.Received, false, "Receive.Received should be false") + AssertEqual(t, m.Send.Sent, false, "Send.Sent should be false") AssertEqual(t, m.Send.Message["txt"], n.Send.Message["txt"], "Message[txt] should be equal") AssertEqual(t, m.Send.Message["icon"], n.Send.Message["icon"], "Message[icon] should be equal") AssertEqual(t, m.Receive.Message["rtxt"], n.Receive.Message["rtxt"], "Message[rtxt] should be equal")