diff --git a/build/ci/.build.yml b/build/ci/.build.yml index 860c71f..6edd38e 100644 --- a/build/ci/.build.yml +++ b/build/ci/.build.yml @@ -3,7 +3,7 @@ when: steps: - name: build - image: golang:1.24-alpine + image: golang:1.24.1-alpine commands: - apk update - apk add bash diff --git a/build/ci/.lint.yml b/build/ci/.lint.yml index 5ff810f..11c97f4 100644 --- a/build/ci/.lint.yml +++ b/build/ci/.lint.yml @@ -3,7 +3,7 @@ when: steps: - name: lint - image: golang:1.24-alpine + image: golang:1.24.1-alpine commands: - apk update - apk add bash curl jq diff --git a/build/ci/.tests.yml b/build/ci/.tests.yml index 61d8312..66596f3 100644 --- a/build/ci/.tests.yml +++ b/build/ci/.tests.yml @@ -3,7 +3,7 @@ when: steps: - name: tests - image: golang:1.24-alpine + image: golang:1.24.1-alpine environment: TEST_DB_HOST: db TEST_DB_PORT: 5432 diff --git a/internal/accounts/repository/account_test.go b/internal/accounts/repository/account_test.go index 85cd846..a191004 100644 --- a/internal/accounts/repository/account_test.go +++ b/internal/accounts/repository/account_test.go @@ -9,7 +9,7 @@ import ( ) func TestRepository_Insert(t *testing.T) { - db := test.SetupTestDB(t, "../..") + db := test.SetupTestDB(t, "../../..") defer db.Close() repo := NewRepository(db) @@ -29,7 +29,7 @@ func TestRepository_Insert(t *testing.T) { } func TestRepository_FetchOneByUsername(t *testing.T) { - db := test.SetupTestDB(t, "../..") + db := test.SetupTestDB(t, "../../..") defer db.Close() repo := NewRepository(db) diff --git a/internal/accounts/service/account.go b/internal/accounts/service/account.go index 910a3f1..580c7a6 100644 --- a/internal/accounts/service/account.go +++ b/internal/accounts/service/account.go @@ -32,6 +32,10 @@ func (s *Service) Login(login domain.AccountLogin) (*domain.AccountWithToken, *c return nil, core.NewInternalServerError(err) } + if account == nil { + return nil, domain.ErrAccountNotFound + } + ok, err := core.ComparePassword(login.Password, account.Password) if err != nil { return nil, domain.ErrBadPassword diff --git a/internal/core/jwt_test.go b/internal/core/jwt_test.go index d9dce0f..bf48f8a 100644 --- a/internal/core/jwt_test.go +++ b/internal/core/jwt_test.go @@ -19,9 +19,9 @@ func TestJWT_GenerateToken(t *testing.T) { assert.NotEmpty(t, token) - claims, err := VerifyJWT(token) - if err != nil { - t.Fatalf("Failed to verify token: %v", err) + claims, jwtErr := VerifyJWT(token) + if jwtErr != nil { + t.Fatalf("Failed to verify token: %v", jwtErr) } assert.Equal(t, claims.AccountId, 1)