test(tags): give fixture documents distinct sort indexes

Create the two tagged documents together so their sort indexes are
unique. Preserve assertions for assignments on both documents and the
additional branch.

Database compilation, handler/domain tests, formatting and source review
pass. The database runtime and full aggregate rerun remain pending.
This commit is contained in:
FredApps 2026-10-10 19:54:25 +02:00
parent 3b470c5d64
commit 27eb423ae9

View File

@ -823,10 +823,16 @@ func Test_agent_UpdateTag(t *testing.T) {
tg.SortIndex = 7
tg.CreatedBy = null.StringFrom(prepUsers(t, db, 1)[0])
})[0]
first := prepTaggedDocument(t, db, tg)
second := prepTaggedDocument(t, db, tg)
docs := prepDocuments(t, db, 2, func(_ int, doc *document.Document) {
doc.OrganizationID = tg.OrganizationID
})
for _, doc := range docs {
prepBranchTags(t, db, tg.OrganizationID, doc.BranchID, tg.ID)
}
branch := prepDocumentBranches(t, db, 1, func(_ int, br *document.Document) {
br.ID = first.ID
br.ID = docs[0].ID
br.OrganizationID = tg.OrganizationID
})[0]
@ -839,7 +845,7 @@ func Test_agent_UpdateTag(t *testing.T) {
TagName: null.StringFrom("Release"),
Color: null.StringFrom("#00a63e"),
},
BranchIDs: []xid.ID{first.BranchID, second.BranchID, branch.BranchID},
BranchIDs: []xid.ID{docs[0].BranchID, docs[1].BranchID, branch.BranchID},
Name: "Release",
Color: "#00a63e",
}