Skip to content

Commit

Permalink
Merge pull request #87 from RamilKhaybulin/release/ISSUE-86
Browse files Browse the repository at this point in the history
[ISSUE-86] support xlsx files in attachments
  • Loading branch information
koodeex committed Apr 24, 2024
2 parents dd7f2ab + 8f6b4c0 commit 2bd2bce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/allure/attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ const (
Webm MimeType = "video/webm"
Mpeg MimeType = "video/mpeg"

Pdf MimeType = "application/pdf"
Pdf MimeType = "application/pdf"
Xlsx MimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
)

var mimeTypeMap = map[MimeType]string{
Expand All @@ -67,6 +68,7 @@ var mimeTypeMap = map[MimeType]string{
Webm: "webm",
Mpeg: "mpeg",
Pdf: "pdf",
Xlsx: "xlsx",
}

// NewAttachment - Constructor. Returns pointer to new attachment object.
Expand Down
4 changes: 4 additions & 0 deletions pkg/allure/attachment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ func TestMimeTypeMap(t *testing.T) {
Webm: "webm",
Mpeg: "mpeg",
Pdf: "pdf",
Xlsx: "xlsx",
}
assert.Equal(t, len(_mimeTypeMap), len(mimeTypeMap), "Miss Some!")
for _type, _format := range _mimeTypeMap {
Expand Down Expand Up @@ -152,5 +153,8 @@ func TestMimeTypeMap(t *testing.T) {

var _Pdf MimeType = "application/pdf"
assert.Equal(t, _Pdf, Pdf)

var _Xlsx MimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
assert.Equal(t, _Xlsx, Xlsx)
})
}

0 comments on commit 2bd2bce

Please sign in to comment.