Skip to content

Commit

Permalink
test: Support asserting on doc index in test results (#2786)
Browse files Browse the repository at this point in the history
## Relevant issue(s)

Resolves #2785

## Description

Support asserting on doc index in test results.

PR does not seek to propagate it's usage, only to permit it's usage.
  • Loading branch information
AndrewSisley authored Jun 27, 2024
1 parent 2efd29a commit dd53c13
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func TestP2POneToManyPeerWithCreateUpdateLinkingSyncedDocToUnsyncedDoc(t *testin
Results: []map[string]any{
{
"Name": "Gulistan",
"Author_id": "bae-6a4c24c0-7b0b-5f51-a274-132d7ca90499",
"Author_id": testUtils.NewDocIndex(0, 0),
"Author": map[string]any{
"Name": "Saadi",
},
Expand All @@ -102,7 +102,7 @@ func TestP2POneToManyPeerWithCreateUpdateLinkingSyncedDocToUnsyncedDoc(t *testin
Results: []map[string]any{
{
"Name": "Gulistan",
"Author_id": "bae-6a4c24c0-7b0b-5f51-a274-132d7ca90499",
"Author_id": testUtils.NewDocIndex(0, 0),
// "Saadi" was not synced to node 1, the update did not
// result in an error and synced to relational id even though "Saadi"
// does not exist in this node.
Expand Down
10 changes: 10 additions & 0 deletions tests/integration/utils2.go
Original file line number Diff line number Diff line change
Expand Up @@ -1880,6 +1880,16 @@ func assertRequestResults(
valueSet := anyOfByField[dfk]
valueSet = append(valueSet, actualValue)
anyOfByField[dfk] = valueSet
case DocIndex:
expectedDocID := s.documents[r.CollectionIndex][r.Index].ID().String()
assertResultsEqual(
s.t,
s.clientType,
expectedDocID,
actualValue,
fmt.Sprintf("node: %v, doc: %v", nodeID, docIndex),
)

default:
assertResultsEqual(
s.t,
Expand Down

0 comments on commit dd53c13

Please sign in to comment.