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:
WithoutPants
2022-12-01 13:54:08 +11:00
committed by GitHub
parent d2395e579c
commit 4daf0a14a2
72 changed files with 2283 additions and 993 deletions

View 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)
})
}
}