Forgot to add test code.

This commit is contained in:
Peter - Ubuntu dual boot
2021-09-19 20:03:48 +01:00
parent 13330c4e1b
commit f530e90d27

View File

@@ -14,13 +14,12 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
func TestAlbumCover(t *testing.T) { func TestAlbumCover(t *testing.T) {
db := test_utils.DatabaseTest(t) db := test_utils.DatabaseTest(t)
rootAlbum := models.Album{ rootAlbum := models.Album{
Title: "root", Title: "root",
Path: "/photos", Path: "/photos",
} }
if !assert.NoError(t, db.Save(&rootAlbum).Error) { if !assert.NoError(t, db.Save(&rootAlbum).Error) {
@@ -36,10 +35,10 @@ func TestAlbumCover(t *testing.T) {
ParentAlbumID: &rootAlbum.ID, ParentAlbumID: &rootAlbum.ID,
}, },
{ {
Title: "child2", Title: "child2",
Path: "/photos/child2", Path: "/photos/child2",
ParentAlbumID: &rootAlbum.ID, ParentAlbumID: &rootAlbum.ID,
CoverID: &TestCoverID, CoverID: &TestCoverID,
}, },
} }
@@ -49,34 +48,34 @@ func TestAlbumCover(t *testing.T) {
photos := []models.Media{ photos := []models.Media{
{ {
Title: "pic1", Title: "pic1",
Path: "/photos/pic1", Path: "/photos/pic1",
AlbumID: 1, AlbumID: 1,
}, },
{ {
Title: "pic2", Title: "pic2",
Path: "/photos/pic2", Path: "/photos/pic2",
AlbumID: 1, AlbumID: 1,
}, },
{ {
Title: "pic3", Title: "pic3",
Path: "/photos/pic3", Path: "/photos/pic3",
AlbumID: 2, AlbumID: 2,
}, },
{ {
Title: "pic4", Title: "pic4",
Path: "/photos/pic4", Path: "/photos/pic4",
AlbumID: 2, AlbumID: 2,
}, },
{ {
Title: "pic5", Title: "pic5",
Path: "/photos/pic5", Path: "/photos/pic5",
AlbumID: 3, AlbumID: 3,
}, },
{ {
Title: "pic6", Title: "pic6",
Path: "/photos/pic6", Path: "/photos/pic6",
AlbumID: 3, AlbumID: 3,
}, },
} }
@@ -154,6 +153,7 @@ func TestAlbumCover(t *testing.T) {
// }) // })
} }
// //
// //
// func (r *albumResolver) Thumbnail(ctx context.Context, obj *models.Album) (*models.Media, error) { // func (r *albumResolver) Thumbnail(ctx context.Context, obj *models.Album) (*models.Media, error) {