Refactors Cover's Extension cleaning in Album

This commit is contained in:
2016-01-25 15:20:19 +01:00
parent c858e99d06
commit 1c39ad27a5
3 changed files with 33 additions and 7 deletions

View File

@@ -38,3 +38,22 @@ func (s *AlbumSuite) TestAuthors(c *C) {
}
}
func (s *AlbumSuite) TestExt(c *C) {
type TestData struct {
A *Album
Res string
}
data := []TestData{
{&Album{CoverURL: "foo/bar/test.jpg"}, ".jpg"},
{&Album{CoverURL: "foo/bar/foo.JPG"}, ".jpg"},
{&Album{CoverURL: "foo/bar/foo.JPEG"}, ".jpeg"},
{&Album{CoverURL: "foo/bar/foo.023879jpg"}, ".jpg"},
{&Album{CoverURL: "foo/bar/foo.PNG"}, ".png"},
{&Album{CoverURL: "foo/bar/foo.gif"}, ".gif"},
}
for _, d := range data {
c.Check(d.A.CoverExt(), Equals, d.Res, Commentf("With URL %s", d.A.CoverURL))
}
}