Skip to content

Commit

Permalink
added some more tests for attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
Johnlon committed Jun 28, 2024
1 parent 078a136 commit d0bfcea
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions attachment_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package godog

import (
"context"
"testing"

"github.com/stretchr/testify/assert"
)

func TestAttach(t *testing.T) {

ctx := context.Background()

ctx = Attach(ctx, Attachment{Body: []byte("body1"), FileName: "fileName1", MediaType: "mediaType1"})
ctx = Attach(ctx, Attachment{Body: []byte("body2"), FileName: "fileName2", MediaType: "mediaType2"})

attachments := Attachments(ctx)

assert.Equal(t, 2, len(attachments))

assert.Equal(t, []byte("body1"), attachments[0].Body)
assert.Equal(t, "fileName1", attachments[0].FileName)
assert.Equal(t, "mediaType1", attachments[0].MediaType)

assert.Equal(t, []byte("body2"), attachments[1].Body)
assert.Equal(t, "fileName2", attachments[1].FileName)
assert.Equal(t, "mediaType2", attachments[1].MediaType)
}

0 comments on commit d0bfcea

Please sign in to comment.