jlelse
/
hugo-micropub
Archived
1
Fork 0
This repository has been archived on 2020-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
hugo-micropub/validation_test.go

26 lines
606 B
Go

package main
import (
"testing"
)
func TestGetContentType(t *testing.T) {
for key, value := range map[string]ContentType{
"": UnsupportedType,
"test": UnsupportedType,
"application/x-www-form-urlencoded": WwwForm,
"application/json": Json,
"multipart/form-data": Multipart,
} {
t.Run(key, func(t *testing.T) {
got, err := GetContentType(key)
if got != value {
t.Errorf("Wrong ContentType")
}
if value == UnsupportedType && err == nil {
t.Errorf("Error is nil")
}
})
}
}