mirror of
https://github.com/hay-kot/homebox.git
synced 2025-08-02 07:40:28 +00:00
testify auto fixes
This commit is contained in:
parent
a60047e390
commit
93f9a40fc0
5 changed files with 10 additions and 10 deletions
|
@ -97,7 +97,7 @@ func TestItemsRepository_GetAll(t *testing.T) {
|
||||||
results, err := tRepos.Items.GetAll(context.Background(), tGroup.ID)
|
results, err := tRepos.Items.GetAll(context.Background(), tGroup.ID)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
assert.Equal(t, length, len(results))
|
assert.Len(t, results, length)
|
||||||
|
|
||||||
for _, item := range results {
|
for _, item := range results {
|
||||||
for _, expectedItem := range expected {
|
for _, expectedItem := range expected {
|
||||||
|
|
|
@ -136,12 +136,12 @@ func TestItemRepository_TreeQuery(t *testing.T) {
|
||||||
|
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
assert.Equal(t, 2, len(locations))
|
assert.Len(t, locations, 2)
|
||||||
|
|
||||||
// Check roots
|
// Check roots
|
||||||
for _, loc := range locations {
|
for _, loc := range locations {
|
||||||
if loc.ID == locs[1].ID {
|
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)
|
path, err := tRepos.Locations.PathForLoc(context.Background(), tGroup.ID, last.ID)
|
||||||
|
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, 3, len(path))
|
assert.Len(t, path, 3)
|
||||||
|
|
||||||
// Check path and order
|
// Check path and order
|
||||||
for i, loc := range path {
|
for i, loc := range path {
|
||||||
|
|
|
@ -67,7 +67,7 @@ func TestMaintenanceEntryRepository_GetLog(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.Equal(t, item.ID, log.ItemID)
|
assert.Equal(t, item.ID, log.ItemID)
|
||||||
assert.Equal(t, 10, len(log.Entries))
|
assert.Len(t, log.Entries, 10)
|
||||||
|
|
||||||
// Calculate the average cost
|
// Calculate the average cost
|
||||||
var total float64
|
var total float64
|
||||||
|
|
|
@ -28,7 +28,7 @@ func TestUserRepo_GetOneEmail(t *testing.T) {
|
||||||
foundUser, err := tRepos.Users.GetOneEmail(ctx, user.Email)
|
foundUser, err := tRepos.Users.GetOneEmail(ctx, user.Email)
|
||||||
|
|
||||||
assert.NotNil(foundUser)
|
assert.NotNil(foundUser)
|
||||||
assert.Nil(err)
|
assert.NoError(err)
|
||||||
assert.Equal(user.Email, foundUser.Email)
|
assert.Equal(user.Email, foundUser.Email)
|
||||||
assert.Equal(user.Name, foundUser.Name)
|
assert.Equal(user.Name, foundUser.Name)
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ func TestUserRepo_GetOneId(t *testing.T) {
|
||||||
foundUser, err := tRepos.Users.GetOneId(ctx, userOut.ID)
|
foundUser, err := tRepos.Users.GetOneId(ctx, userOut.ID)
|
||||||
|
|
||||||
assert.NotNil(foundUser)
|
assert.NotNil(foundUser)
|
||||||
assert.Nil(err)
|
assert.NoError(err)
|
||||||
assert.Equal(user.Email, foundUser.Email)
|
assert.Equal(user.Email, foundUser.Email)
|
||||||
assert.Equal(user.Name, foundUser.Name)
|
assert.Equal(user.Name, foundUser.Name)
|
||||||
|
|
||||||
|
@ -131,12 +131,12 @@ func TestUserRepo_Delete(t *testing.T) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
allUsers, _ := tRepos.Users.GetAll(ctx)
|
allUsers, _ := tRepos.Users.GetAll(ctx)
|
||||||
|
|
||||||
assert.Greater(t, len(allUsers), 0)
|
assert.NotEmpty(t, allUsers)
|
||||||
err := tRepos.Users.DeleteAll(ctx)
|
err := tRepos.Users.DeleteAll(ctx)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
allUsers, _ = tRepos.Users.GetAll(ctx)
|
allUsers, _ = tRepos.Users.GetAll(ctx)
|
||||||
assert.Equal(t, len(allUsers), 0)
|
assert.Empty(t, allUsers)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUserRepo_GetSuperusers(t *testing.T) {
|
func TestUserRepo_GetSuperusers(t *testing.T) {
|
||||||
|
|
|
@ -59,5 +59,5 @@ func Test_Mailer(t *testing.T) {
|
||||||
|
|
||||||
err = mailer.Send(msg)
|
err = mailer.Send(msg)
|
||||||
|
|
||||||
assert.Nil(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue