fix test case

This commit is contained in:
neha-Gupta1 2023-05-04 11:36:44 +05:30
parent 341bfd4616
commit 16cb69b8a9

View File

@ -137,6 +137,7 @@ func (c Mail) GetItem(
var ( var (
size int64 size int64
attachSize int32 attachSize int32
mailBody models.ItemBodyable
) )
// Will need adjusted if attachments start allowing paging. // Will need adjusted if attachments start allowing paging.
headers := buildPreferHeaders(false, immutableIDs) headers := buildPreferHeaders(false, immutableIDs)
@ -149,13 +150,16 @@ func (c Mail) GetItem(
return nil, nil, graph.Stack(ctx, err) return nil, nil, graph.Stack(ctx, err)
} }
if !ptr.Val(mail.GetHasAttachments()) && !HasAttachments(mail.GetBody()) { mailBody = mail.GetBody()
if !ptr.Val(mail.GetHasAttachments()) && !HasAttachments(mailBody) {
return mail, MailInfo(mail, 0), nil return mail, MailInfo(mail, 0), nil
} }
bodySize := ptr.Val(mail.GetBody().GetContent()) if mailBody != nil {
if bodySize != "" { bodySize := ptr.Val(mailBody.GetContent())
size = int64(len(bodySize)) if bodySize != "" {
size = int64(len(bodySize))
}
} }
options := &users.ItemMessagesItemAttachmentsRequestBuilderGetRequestConfiguration{ options := &users.ItemMessagesItemAttachmentsRequestBuilderGetRequestConfiguration{
@ -178,6 +182,7 @@ func (c Mail) GetItem(
} }
mail.SetAttachments(attached.GetValue()) mail.SetAttachments(attached.GetValue())
return mail, MailInfo(mail, size), nil return mail, MailInfo(mail, size), nil
} }