Skip to content

Commit

Permalink
fix(tests): rename TestListStrainsByIds to TestListStrainsByIDs for c…
Browse files Browse the repository at this point in the history
…onsistency

Adding the pluralization of "IDs" in the test function and method names
improves clarity and consistency with common terminology in programming,
ensuring that the naming convention reflects the nature of the data
being handled. Additionally, a sleep delay is introduced in the
`createTestStrains` function to prevent potential race conditions during
tests.
  • Loading branch information
cybersiddhu committed Nov 13, 2024
1 parent dec40a0 commit e1e7b1f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions internal/repository/arangodb/strain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ func createTestStrains(
if err != nil {
return err
}
time.Sleep(100 * time.Millisecond)
start++
}
return nil
Expand Down Expand Up @@ -516,15 +517,15 @@ func TestListStrains(t *testing.T) {
testModelListSort(ls3, t)
}

func TestListStrainsByIds(t *testing.T) {
func TestListStrainsByIDs(t *testing.T) {
t.Parallel()
assert, repo := setUp(t)
defer tearDown(repo)
// add 10 new test strains
ids, err := createTestStrainsWithIDs(30, General, repo)
assert.NoError(err, "expect no error from creating strains")
// get first five results
ls, err := repo.ListStrainsByIds(&stock.StockIdList{Id: ids})
ls, err := repo.ListStrainsByIDs(&stock.StockIdList{Id: ids})
assert.NoError(err, "expect no error in getting strains")
assert.Len(ls, 30, "should match the provided limit number")
for _, stock := range ls {
Expand Down Expand Up @@ -558,7 +559,7 @@ func TestListStrainsByIds(t *testing.T) {
)
pids, err := createTestStrainsWithParent(30, General, repo, pm.StockID)
assert.NoError(err, "expect no error from creating strains")
pls, err := repo.ListStrainsByIds(&stock.StockIdList{Id: pids})
pls, err := repo.ListStrainsByIDs(&stock.StockIdList{Id: pids})
assert.NoError(err, "expect no error in getting 30 stocks with parents")
assert.Len(pls, 30, "should match the provided limit number")
for _, stock := range pls {
Expand All @@ -585,7 +586,7 @@ func TestListStrainsByIds(t *testing.T) {
)
}
// Non-existing ids
els, err := repo.ListStrainsByIds(
els, err := repo.ListStrainsByIDs(
&stock.StockIdList{Id: []string{"DBN589343", "DBN48473232"}},
)
assert.NoErrorf(
Expand Down

0 comments on commit e1e7b1f

Please sign in to comment.