Fix indentation a bit
This commit is contained in:
parent
790e95a26c
commit
afb8de0be2
@ -142,73 +142,73 @@ func (suite *EMLUnitSuite) TestConvert_edge_cases() {
|
|||||||
testdata.EmailWithinEmail,
|
testdata.EmailWithinEmail,
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, b := range bodies {
|
tests := []struct {
|
||||||
tests := []struct {
|
name string
|
||||||
name string
|
transform func(models.Messageable)
|
||||||
transform func(models.Messageable)
|
}{
|
||||||
}{
|
{
|
||||||
{
|
name: "just a name",
|
||||||
name: "just a name",
|
transform: func(msg models.Messageable) {
|
||||||
transform: func(msg models.Messageable) {
|
msg.GetFrom().GetEmailAddress().SetName(ptr.To("alphabob"))
|
||||||
msg.GetFrom().GetEmailAddress().SetName(ptr.To("alphabob"))
|
msg.GetFrom().GetEmailAddress().SetAddress(nil)
|
||||||
msg.GetFrom().GetEmailAddress().SetAddress(nil)
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
name: "incorrect address",
|
{
|
||||||
transform: func(msg models.Messageable) {
|
name: "incorrect address",
|
||||||
msg.GetFrom().GetEmailAddress().SetAddress(ptr.To("invalid"))
|
transform: func(msg models.Messageable) {
|
||||||
},
|
msg.GetFrom().GetEmailAddress().SetAddress(ptr.To("invalid"))
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
name: "empty attachment",
|
{
|
||||||
transform: func(msg models.Messageable) {
|
name: "empty attachment",
|
||||||
attachments := msg.GetAttachments()
|
transform: func(msg models.Messageable) {
|
||||||
err := attachments[0].GetBackingStore().Set("contentBytes", []uint8{})
|
attachments := msg.GetAttachments()
|
||||||
require.NoError(suite.T(), err, "setting attachment content")
|
err := attachments[0].GetBackingStore().Set("contentBytes", []uint8{})
|
||||||
},
|
require.NoError(suite.T(), err, "setting attachment content")
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
name: "attachment without name",
|
{
|
||||||
transform: func(msg models.Messageable) {
|
name: "attachment without name",
|
||||||
attachments := msg.GetAttachments()
|
transform: func(msg models.Messageable) {
|
||||||
attachments[1].SetName(ptr.To(""))
|
attachments := msg.GetAttachments()
|
||||||
|
attachments[1].SetName(ptr.To(""))
|
||||||
|
|
||||||
// This test has to be run on a non inline attachment
|
// This test has to be run on a non inline attachment
|
||||||
// as inline attachments use contentID instead of name
|
// as inline attachments use contentID instead of name
|
||||||
// even when there is a name.
|
// even when there is a name.
|
||||||
assert.False(suite.T(), ptr.Val(attachments[1].GetIsInline()))
|
assert.False(suite.T(), ptr.Val(attachments[1].GetIsInline()))
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
name: "attachment with nil name",
|
{
|
||||||
transform: func(msg models.Messageable) {
|
name: "attachment with nil name",
|
||||||
attachments := msg.GetAttachments()
|
transform: func(msg models.Messageable) {
|
||||||
attachments[1].SetName(nil)
|
attachments := msg.GetAttachments()
|
||||||
|
attachments[1].SetName(nil)
|
||||||
|
|
||||||
// This test has to be run on a non inline attachment
|
// This test has to be run on a non inline attachment
|
||||||
// as inline attachments use contentID instead of name
|
// as inline attachments use contentID instead of name
|
||||||
// even when there is a name.
|
// even when there is a name.
|
||||||
assert.False(suite.T(), ptr.Val(attachments[1].GetIsInline()))
|
assert.False(suite.T(), ptr.Val(attachments[1].GetIsInline()))
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
name: "multiple attachments without name",
|
{
|
||||||
transform: func(msg models.Messageable) {
|
name: "multiple attachments without name",
|
||||||
attachments := msg.GetAttachments()
|
transform: func(msg models.Messageable) {
|
||||||
attachments[1].SetName(ptr.To(""))
|
attachments := msg.GetAttachments()
|
||||||
attachments[2].SetName(ptr.To(""))
|
attachments[1].SetName(ptr.To(""))
|
||||||
|
attachments[2].SetName(ptr.To(""))
|
||||||
|
|
||||||
// This test has to be run on a non inline attachment
|
// This test has to be run on a non inline attachment
|
||||||
// as inline attachments use contentID instead of name
|
// as inline attachments use contentID instead of name
|
||||||
// even when there is a name.
|
// even when there is a name.
|
||||||
assert.False(suite.T(), ptr.Val(attachments[1].GetIsInline()))
|
assert.False(suite.T(), ptr.Val(attachments[1].GetIsInline()))
|
||||||
assert.False(suite.T(), ptr.Val(attachments[2].GetIsInline()))
|
assert.False(suite.T(), ptr.Val(attachments[2].GetIsInline()))
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
for _, b := range bodies {
|
||||||
suite.Run(test.name, func() {
|
suite.Run(test.name, func() {
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user