feat(GODT-2725): Implement receive message step with expected structure exposed.
This commit is contained in:
@ -19,6 +19,7 @@ package tests
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
@ -342,6 +343,26 @@ func (s *scenario) imapClientEventuallySeesTheFollowingMessagesInMailbox(clientI
|
||||
})
|
||||
}
|
||||
|
||||
func (s *scenario) imapClientSeesMessageInMailboxWithStructure(clientID, mailbox string, message *godog.DocString) error {
|
||||
return eventually(func() error {
|
||||
_, client := s.t.getIMAPClient(clientID)
|
||||
|
||||
var msgStruct MessageStruct
|
||||
if err := json.Unmarshal([]byte(message.Content), &msgStruct); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fetch, err := clientFetch(client, mailbox)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
haveMessages := xslices.Map(fetch, newMessageStructFromIMAP)
|
||||
|
||||
return matchStructure(haveMessages, msgStruct)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *scenario) imapClientSeesMessagesInMailbox(clientID string, count int, mailbox string) error {
|
||||
_, client := s.t.getIMAPClient(clientID)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user