mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
* Don't load image files by default * Don't load gallery files by default * Don't load scene files by default * Retry locked transactions forever * Don't show release notes if config not loaded * Don't translate path slashes in export
35 lines
638 B
Go
35 lines
638 B
Go
package image
|
|
|
|
import (
|
|
"fmt"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/stashapp/stash/pkg/models"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestIsCover(t *testing.T) {
|
|
type test struct {
|
|
fn string
|
|
isCover bool
|
|
}
|
|
|
|
tests := []test{
|
|
{"cover.jpg", true},
|
|
{"covernot.jpg", false},
|
|
{"Cover.jpg", false},
|
|
{fmt.Sprintf("subDir%scover.jpg", string(filepath.Separator)), true},
|
|
{"endsWithcover.jpg", true},
|
|
{"cover.png", false},
|
|
}
|
|
|
|
assert := assert.New(t)
|
|
for _, tc := range tests {
|
|
img := &models.Image{
|
|
Path: tc.fn,
|
|
}
|
|
assert.Equal(tc.isCover, IsCover(img), "expected: %t for %s", tc.isCover, tc.fn)
|
|
}
|
|
}
|