Skip to content

Commit

Permalink
add TestGetMimeType
Browse files Browse the repository at this point in the history
Signed-off-by: Davor Kapsa <[email protected]>
  • Loading branch information
dvrkps authored and dennwc committed Oct 3, 2018
1 parent f9c6cba commit 66fda9a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,24 @@ func (s *EnryTestSuite) TestIsImage() {
}
}

func (s *EnryTestSuite) TestGetMimeType() {
tests := []struct {
name string
path string
lang string
expected string
}{
{name: "TestGetMimeType_1", path: "text.txt", lang: "", expected: "text/plain"},
{name: "TestGetMimeType_2", path: "file.go", lang: "Go", expected: "text/x-go"},
{name: "TestGetMimeType_3", path: "image.png", lang: "", expected: "image/png"},
}

for _, test := range tests {
is := GetMimeType(test.path, test.lang)
assert.Equal(s.T(), is, test.expected, fmt.Sprintf("%v: is = %v, expected: %v", test.name, is, test.expected))
}
}

func (s *EnryTestSuite) TestIsConfiguration() {
tests := []struct {
name string
Expand Down

0 comments on commit 66fda9a

Please sign in to comment.