mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-14 18:05:55 -07:00
feat: add tests
This commit is contained in:
parent
e82014093e
commit
f60d5e7cad
2 changed files with 34 additions and 1 deletions
32
type_test.go
32
type_test.go
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue