mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 08:26:00 +01:00
* Remove ID from PerformerPartial * Separate studio model from sqlite model * Separate movie model from sqlite model * Separate tag model from sqlite model * Separate saved filter model from sqlite model * Separate scene marker model from sqlite model * Separate gallery chapter model from sqlite model * Move ErrNoRows checks into sqlite, improve empty result error messages * Move SQLiteDate and SQLiteTimestamp to sqlite * Use changesetTranslator everywhere, refactor for consistency * Make PerformerStore.DestroyImage private * Fix rating on movie create
43 lines
815 B
Go
43 lines
815 B
Go
//go:build integration
|
|
// +build integration
|
|
|
|
package sqlite_test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestChapterFindByGalleryID(t *testing.T) {
|
|
withTxn(func(ctx context.Context) error {
|
|
mqb := db.GalleryChapter
|
|
|
|
galleryID := galleryIDs[galleryIdxWithChapters]
|
|
chapters, err := mqb.FindByGalleryID(ctx, galleryID)
|
|
|
|
if err != nil {
|
|
t.Errorf("Error finding chapters: %s", err.Error())
|
|
}
|
|
|
|
assert.Greater(t, len(chapters), 0)
|
|
for _, chapter := range chapters {
|
|
assert.Equal(t, galleryIDs[galleryIdxWithChapters], chapter.GalleryID)
|
|
}
|
|
|
|
chapters, err = mqb.FindByGalleryID(ctx, 0)
|
|
|
|
if err != nil {
|
|
t.Errorf("Error finding chapter: %s", err.Error())
|
|
}
|
|
|
|
assert.Len(t, chapters, 0)
|
|
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// TODO Update
|
|
// TODO Destroy
|
|
// TODO Find
|