mirror of
https://github.com/tgdrive/teldrive.git
synced 2025-01-10 17:19:56 +08:00
53 lines
837 B
Go
53 lines
837 B
Go
//gen test suite
|
|
|
|
package category
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestGetCategory(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
fileName string
|
|
want Category
|
|
}{
|
|
{
|
|
name: "Document",
|
|
fileName: "file.doc",
|
|
want: Document,
|
|
},
|
|
{
|
|
name: "Image",
|
|
fileName: "file.jpg",
|
|
want: Image,
|
|
},
|
|
{
|
|
name: "Video",
|
|
fileName: "file.mp4",
|
|
want: Video,
|
|
},
|
|
{
|
|
name: "Audio",
|
|
fileName: "file.mp3",
|
|
want: Audio,
|
|
},
|
|
{
|
|
name: "Archive",
|
|
fileName: "file.zip",
|
|
want: Archive,
|
|
},
|
|
{
|
|
name: "Other",
|
|
fileName: "file",
|
|
want: Other,
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := GetCategory(tt.fileName); got != tt.want {
|
|
t.Errorf("GetCategory() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|