Skip to content

Commit

Permalink
add pageLink field in message
Browse files Browse the repository at this point in the history
  • Loading branch information
RenCurs committed Dec 14, 2023
1 parent 19bb8f8 commit 660f5e0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions v1/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ package v1
import (
"bytes"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"strings"
"testing"
Expand Down Expand Up @@ -497,6 +499,7 @@ func (t *MGClientTest) Test_TextMessages() {
ExternalID: "external_id",
Type: MsgTypeText,
Text: "hello!",
PageLink: "https://example.loca/catalog/1",
},
Originator: OriginatorCustomer,
Customer: Customer{
Expand All @@ -515,6 +518,17 @@ func (t *MGClientTest) Test_TextMessages() {
defer gock.Off()
t.gock().
Post(t.transportURL("messages")).
Filter(func(request *http.Request) bool {
data, err := io.ReadAll(request.Body)

Check failure on line 522 in v1/client_test.go

View workflow job for this annotation

GitHub Actions / Tests (1.13)

undefined: io.ReadAll

Check failure on line 522 in v1/client_test.go

View workflow job for this annotation

GitHub Actions / Tests (1.14)

undefined: io.ReadAll

Check failure on line 522 in v1/client_test.go

View workflow job for this annotation

GitHub Actions / Tests (1.15)

undefined: io.ReadAll
if err != nil {
return false
}
request.Body = io.NopCloser(bytes.NewReader(data))

Check failure on line 526 in v1/client_test.go

View workflow job for this annotation

GitHub Actions / Tests (1.13)

undefined: io.NopCloser

Check failure on line 526 in v1/client_test.go

View workflow job for this annotation

GitHub Actions / Tests (1.14)

undefined: io.NopCloser

Check failure on line 526 in v1/client_test.go

View workflow job for this annotation

GitHub Actions / Tests (1.15)

undefined: io.NopCloser

var snd SendData
t.Require().NoError(json.Unmarshal(data, &snd))
return t.Assert().Equal("https://example.loca/catalog/1", snd.Message.PageLink)
}).
Reply(http.StatusOK).
JSON(
MessagesResponse{
Expand Down
1 change: 1 addition & 0 deletions v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ type Message struct {
Text string `json:"text,omitempty"`
Note string `json:"note,omitempty"`
Items []Item `json:"items,omitempty"`
PageLink string `json:"pageLink,omitempty"`
}

// SendMessage struct.
Expand Down

0 comments on commit 660f5e0

Please sign in to comment.