Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor user file structure, add mocks and tests #22

Merged
merged 7 commits into from
Mar 6, 2025

Conversation

marrriamme
Copy link
Collaborator

  1. Поменяла разположение файлов
  2. Добавила моки
  3. Добавила тесты

@Benzogang-Tape Benzogang-Tape self-requested a review March 6, 2025 16:14
if err != nil {
log.Fatal("Error loading .env file")
}
secretKey := os.Getenv("TOKEN_SECRET")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Переименуй в JWT_SIGNATURE

func (t *Tokenator) ParseJWT(tokenString string) (*JWTClaims, error) {
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
Copy link
Collaborator

@Benzogang-Tape Benzogang-Tape Mar 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fatal насколько я помню делает под капотом os.Exit(1), тут лучше просто залогировать и вернуть ошибку. Если ещё где-то есть log.Fatal(), кроме main.go, то тоже поправь(к тестам не относится)

Copy link
Collaborator

@Benzogang-Tape Benzogang-Tape left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Всё круто, пару комментов оставил, как поправишь - можешь вливать. Также перед тем как вливать сделай rebase на develop и go mod tidy, чтобы конфликтов не было. И кинь пж в чатик в тг файл .env, чтобы все его могли юзать

@marrriamme marrriamme merged commit 860eb87 into develop Mar 6, 2025
@marrriamme marrriamme deleted the test/add-mocks branch March 6, 2025 19:46
@marrriamme marrriamme restored the test/add-mocks branch March 6, 2025 19:46
@marrriamme marrriamme deleted the test/add-mocks branch March 6, 2025 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants