You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
692 B

package converter
import "testing"
func TestExtractAlbumFolder(t *testing.T) {
tests := []struct {
m *message
albumFolder string
}{
{createMessage("/test/artistX", "/test/artistX/albumY/songX.flac"), "albumY"},
{createMessage("/test/artistX/", "/test/artistX/album Y/songX.flac"), "album Y"},
}
for _, tt := range tests {
actual := tt.m.extractAlbumFolder()
expected := tt.albumFolder
if actual != expected {
t.Errorf("expected %v, got %v", expected, actual)
}
}
}
func createMessage(artistPath, filePath string) *message {
return &message{
Artist: artist{
Path: artistPath,
},
TrackFiles: []trackFile{
{
Path: filePath,
},
},
}
}