testify auto fixes

This commit is contained in:
Hayden 2023-12-20 13:31:47 -06:00
parent a60047e390
commit 93f9a40fc0
No known key found for this signature in database
GPG key ID: 17CF79474E257545
5 changed files with 10 additions and 10 deletions

View file

@ -97,7 +97,7 @@ func TestItemsRepository_GetAll(t *testing.T) {
results, err := tRepos.Items.GetAll(context.Background(), tGroup.ID)
assert.NoError(t, err)
assert.Equal(t, length, len(results))
assert.Len(t, results, length)
for _, item := range results {
for _, expectedItem := range expected {

View file

@ -136,12 +136,12 @@ func TestItemRepository_TreeQuery(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, 2, len(locations))
assert.Len(t, locations, 2)
// Check roots
for _, loc := range locations {
if loc.ID == locs[1].ID {
assert.Equal(t, 1, len(loc.Children))
assert.Len(t, loc.Children, 1)
}
}
}
@ -165,7 +165,7 @@ func TestLocationRepository_PathForLoc(t *testing.T) {
path, err := tRepos.Locations.PathForLoc(context.Background(), tGroup.ID, last.ID)
assert.NoError(t, err)
assert.Equal(t, 3, len(path))
assert.Len(t, path, 3)
// Check path and order
for i, loc := range path {

View file

@ -67,7 +67,7 @@ func TestMaintenanceEntryRepository_GetLog(t *testing.T) {
}
assert.Equal(t, item.ID, log.ItemID)
assert.Equal(t, 10, len(log.Entries))
assert.Len(t, log.Entries, 10)
// Calculate the average cost
var total float64

View file

@ -28,7 +28,7 @@ func TestUserRepo_GetOneEmail(t *testing.T) {
foundUser, err := tRepos.Users.GetOneEmail(ctx, user.Email)
assert.NotNil(foundUser)
assert.Nil(err)
assert.NoError(err)
assert.Equal(user.Email, foundUser.Email)
assert.Equal(user.Name, foundUser.Name)
@ -46,7 +46,7 @@ func TestUserRepo_GetOneId(t *testing.T) {
foundUser, err := tRepos.Users.GetOneId(ctx, userOut.ID)
assert.NotNil(foundUser)
assert.Nil(err)
assert.NoError(err)
assert.Equal(user.Email, foundUser.Email)
assert.Equal(user.Name, foundUser.Name)
@ -131,12 +131,12 @@ func TestUserRepo_Delete(t *testing.T) {
ctx := context.Background()
allUsers, _ := tRepos.Users.GetAll(ctx)
assert.Greater(t, len(allUsers), 0)
assert.NotEmpty(t, allUsers)
err := tRepos.Users.DeleteAll(ctx)
assert.NoError(t, err)
allUsers, _ = tRepos.Users.GetAll(ctx)
assert.Equal(t, len(allUsers), 0)
assert.Empty(t, allUsers)
}
func TestUserRepo_GetSuperusers(t *testing.T) {

View file

@ -59,5 +59,5 @@ func Test_Mailer(t *testing.T) {
err = mailer.Send(msg)
assert.Nil(t, err)
assert.NoError(t, err)
}