mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Performer disambiguation and aliases (#3113)
* Refactor performer relationships * Remove checksum from performer * Add disambiguation, overhaul aliases * Add disambiguation filter criterion * Improve name matching during import * Add disambiguation filtering in UI * Include aliases in performer select
This commit is contained in:
52
pkg/models/jsonschema/performer_test.go
Normal file
52
pkg/models/jsonschema/performer_test.go
Normal file
@@ -0,0 +1,52 @@
|
||||
package jsonschema
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func Test_loadPerformer(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
input string
|
||||
want Performer
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "alias list",
|
||||
input: `
|
||||
{
|
||||
"aliases": ["alias1", "alias2"]
|
||||
}`,
|
||||
want: Performer{
|
||||
Aliases: []string{"alias1", "alias2"},
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "alias string list",
|
||||
input: `
|
||||
{
|
||||
"aliases": "alias1, alias2"
|
||||
}`,
|
||||
want: Performer{
|
||||
Aliases: []string{"alias1", "alias2"},
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
r := strings.NewReader(tt.input)
|
||||
got, err := loadPerformer(r)
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("loadPerformer() error = %v, wantErr %v", err, tt.wantErr)
|
||||
return
|
||||
}
|
||||
|
||||
assert.Equal(t, &tt.want, got)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user