feat(generation): select articles in three passes
This commit is contained in:
@ -0,0 +1,20 @@
|
||||
package companycatalog
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTicket34InverseAliasesAreExactResolvedAndUnambiguous(t *testing.T) {
|
||||
c := &Catalog{byID: map[string]Company{"one": {CompanyID: "one", Name: "One Corporation"}, "two": {CompanyID: "two", Name: "Two Corporation"}}}
|
||||
if err := c.loadAliases([]byte(`{"version":1,"aliases":[{"alias":"ONE","company_ids":["one"]},{"alias":"SHARED","company_ids":["one","two"]}]}`)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
got, err := c.MentionNames("one")
|
||||
if err != nil || !reflect.DeepEqual(got, []string{"One Corporation", "one"}) {
|
||||
t.Fatal(got, err)
|
||||
}
|
||||
if _, err = c.MentionNames("missing"); err == nil {
|
||||
t.Fatal("unknown identity accepted")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user