fix linter errors

This commit is contained in:
Hayden 2022-09-03 01:52:05 -08:00
parent 39d8ff03f8
commit b33ef5f029
14 changed files with 44 additions and 307 deletions

View file

@ -27,7 +27,8 @@ func Test_Locations_Get(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, loc.ID, foundLoc.ID)
testRepos.Locations.Delete(context.Background(), loc.ID)
err = testRepos.Locations.Delete(context.Background(), loc.ID)
assert.NoError(t, err)
}
func Test_LocationsGetAllWithCount(t *testing.T) {
@ -36,8 +37,9 @@ func Test_LocationsGetAllWithCount(t *testing.T) {
Name: fk.RandomString(10),
Description: fk.RandomString(100),
})
assert.NoError(t, err)
testRepos.Items.Create(ctx, testGroup.ID, types.ItemCreate{
_, err = testRepos.Items.Create(ctx, testGroup.ID, types.ItemCreate{
Name: fk.RandomString(10),
Description: fk.RandomString(100),
LocationID: result.ID,
@ -65,7 +67,8 @@ func Test_Locations_Create(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, loc.ID, foundLoc.ID)
testRepos.Locations.Delete(context.Background(), loc.ID)
err = testRepos.Locations.Delete(context.Background(), loc.ID)
assert.NoError(t, err)
}
func Test_Locations_Update(t *testing.T) {
@ -88,7 +91,8 @@ func Test_Locations_Update(t *testing.T) {
assert.Equal(t, update.Name, foundLoc.Name)
assert.Equal(t, update.Description, foundLoc.Description)
testRepos.Locations.Delete(context.Background(), loc.ID)
err = testRepos.Locations.Delete(context.Background(), loc.ID)
assert.NoError(t, err)
}
func Test_Locations_Delete(t *testing.T) {

View file

@ -34,8 +34,9 @@ func Test_EntAuthTokenRepo_CreateToken(t *testing.T) {
assert.Equal(expiresAt, token.ExpiresAt)
// Cleanup
testRepos.Users.Delete(ctx, userOut.ID)
testRepos.AuthTokens.DeleteAll(ctx)
assert.NoError(testRepos.Users.Delete(ctx, userOut.ID))
_, err = testRepos.AuthTokens.DeleteAll(ctx)
assert.NoError(err)
}
func Test_EntAuthTokenRepo_GetUserByToken(t *testing.T) {
@ -65,8 +66,9 @@ func Test_EntAuthTokenRepo_GetUserByToken(t *testing.T) {
assert.Equal(userOut.Email, foundUser.Email)
// Cleanup
testRepos.Users.Delete(ctx, userOut.ID)
testRepos.AuthTokens.DeleteAll(ctx)
assert.NoError(testRepos.Users.Delete(ctx, userOut.ID))
_, err = testRepos.AuthTokens.DeleteAll(ctx)
assert.NoError(err)
}
func Test_EntAuthTokenRepo_PurgeExpiredTokens(t *testing.T) {
@ -108,6 +110,7 @@ func Test_EntAuthTokenRepo_PurgeExpiredTokens(t *testing.T) {
}
// Cleanup
testRepos.Users.Delete(ctx, userOut.ID)
testRepos.AuthTokens.DeleteAll(ctx)
assert.NoError(testRepos.Users.Delete(ctx, userOut.ID))
_, err = testRepos.AuthTokens.DeleteAll(ctx)
assert.NoError(err)
}

View file

@ -28,7 +28,8 @@ func Test_EntUserRepo_GetOneEmail(t *testing.T) {
user := UserFactory()
ctx := context.Background()
testRepos.Users.Create(ctx, user)
_, err := testRepos.Users.Create(ctx, user)
assert.NoError(err)
foundUser, err := testRepos.Users.GetOneEmail(ctx, user.Email)
@ -38,7 +39,8 @@ func Test_EntUserRepo_GetOneEmail(t *testing.T) {
assert.Equal(user.Name, foundUser.Name)
// Cleanup
testRepos.Users.DeleteAll(ctx)
err = testRepos.Users.DeleteAll(ctx)
assert.NoError(err)
}
func Test_EntUserRepo_GetOneId(t *testing.T) {
@ -55,7 +57,8 @@ func Test_EntUserRepo_GetOneId(t *testing.T) {
assert.Equal(user.Name, foundUser.Name)
// Cleanup
testRepos.Users.DeleteAll(ctx)
err = testRepos.Users.DeleteAll(ctx)
assert.NoError(err)
}
func Test_EntUserRepo_GetAll(t *testing.T) {
@ -95,11 +98,12 @@ func Test_EntUserRepo_GetAll(t *testing.T) {
}
for _, usr := range created {
testRepos.Users.Delete(ctx, usr.ID)
_ = testRepos.Users.Delete(ctx, usr.ID)
}
// Cleanup
testRepos.Users.DeleteAll(ctx)
err = testRepos.Users.DeleteAll(ctx)
assert.NoError(t, err)
}
func Test_EntUserRepo_Update(t *testing.T) {
@ -119,7 +123,8 @@ func Test_EntUserRepo_Delete(t *testing.T) {
allUsers, _ := testRepos.Users.GetAll(ctx)
assert.Greater(t, len(allUsers), 0)
testRepos.Users.DeleteAll(ctx)
err := testRepos.Users.DeleteAll(ctx)
assert.NoError(t, err)
allUsers, _ = testRepos.Users.GetAll(ctx)
assert.Equal(t, len(allUsers), 0)
@ -154,5 +159,6 @@ func Test_EntUserRepo_GetSuperusers(t *testing.T) {
}
// Cleanup
testRepos.Users.DeleteAll(ctx)
err = testRepos.Users.DeleteAll(ctx)
assert.NoError(t, err)
}