feat: add tests

This commit is contained in:
Tomas Aparicio 2015-04-08 10:36:59 +02:00
parent e82014093e
commit f60d5e7cad
2 changed files with 34 additions and 1 deletions

View file

@ -48,3 +48,35 @@ func TestDeterminateImageTypeName(t *testing.T) {
}
}
}
func TestIsTypeSupported(t *testing.T) {
types := []struct {
name ImageType
}{
{JPEG}, {PNG}, {WEBP},
}
for _, n := range types {
if IsTypeSupported(n.name) == false {
t.Fatal("Image type is not valid")
}
}
}
func TestIsTypeNameSupported(t *testing.T) {
types := []struct {
name string
expected bool
}{
{"jpg", true},
{"png", true},
{"webp", true},
{"gif", false},
}
for _, n := range types {
if IsTypeNameSupported(n.name) != n.expected {
t.Fatal("Image type is not valid")
}
}
}