Skip to content

Commit

Permalink
tests: add GetByXXX and GetByXXXWithTx method #41
Browse files Browse the repository at this point in the history
  • Loading branch information
54m committed Apr 4, 2022
1 parent ab45270 commit 9779365
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions generator/testfiles/not_auto/tests/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,12 @@ func TestFirestore(t *testing.T) {
ttrr.Fatalf("unexpected err == ErrUniqueConstraint")
}
})

tr.Run("GetByXXX", func(ttr *testing.T) {
if _, err := taskRepo.GetByDesc(ctx, fmt.Sprintf("%s%d", desc, 1001)); err != nil {
ttr.Fatalf("%+v", err)
}
})
})
}

Expand Down Expand Up @@ -495,6 +501,18 @@ func TestFirestoreTransaction_Single(t *testing.T) {
tr.Fatalf("unexpected err == ErrUniqueConstraint")
}
})

t.Run("GetByXXXWithTx", func(tr *testing.T) {
if err := client.RunTransaction(ctx, func(cx context.Context, tx *firestore.Transaction) error {
if _, err := taskRepo.GetByDescWithTx(tx, fmt.Sprintf("%s01", desc)); err != nil {
return err
}

return nil
}); err != nil {
tr.Fatalf("error: %+v", err)
}
})
}

func TestFirestoreTransaction_Multi(t *testing.T) {
Expand Down

0 comments on commit 9779365

Please sign in to comment.