refactor: [shitty claude AI first try] restructure server and user services, add new test cases, and improve error handling
This commit is contained in:
34
internal/api/auth/repo/auth_repo_test.go
Normal file
34
internal/api/auth/repo/auth_repo_test.go
Normal file
@ -0,0 +1,34 @@
|
||||
package repo
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"git.logidex.ru/fakz9/logidex-id/internal/api/auth/domain"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestNewAuthRepo(t *testing.T) {
|
||||
// Test with nil client for interface testing
|
||||
// In real tests, you would use a mock or test container
|
||||
repo := NewAuthRepo(nil)
|
||||
|
||||
assert.NotNil(t, repo)
|
||||
assert.Implements(t, (*domain.AuthRepository)(nil), repo)
|
||||
}
|
||||
|
||||
func TestAuthRepo_Interface(t *testing.T) {
|
||||
// Test that our auth repo implements the domain interface
|
||||
var _ domain.AuthRepository = (*authRepo)(nil)
|
||||
|
||||
// Test constructor returns correct interface
|
||||
repo := NewAuthRepo(nil)
|
||||
|
||||
// Verify interface compliance
|
||||
assert.Implements(t, (*domain.AuthRepository)(nil), repo)
|
||||
}
|
||||
|
||||
// Note: Actual Redis operations testing requires either:
|
||||
// 1. Test containers with real Redis
|
||||
// 2. A simpler interface wrapper around Redis
|
||||
// 3. A Redis mock library specifically designed for rueidis
|
||||
// For now, we focus on interface compliance and constructor behavior
|
||||
Reference in New Issue
Block a user