🧪 test: add comprehensive BDD test suite for user authentication
Added BDD test scenarios covering: - User registration with validation - Successful and failed authentication - Admin authentication with master password - JWT token generation and validation - Password reset workflow - Edge cases and error handling BDD Features: - 20+ authentication scenarios - JWT validation edge cases - Password reset security scenarios - Input validation tests - Error response verification BDD Infrastructure: - Step definitions for authentication workflows - Test server with user management endpoints - JWT parsing and validation utilities - Common step patterns for reuse Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"dance-lessons-coach/pkg/bdd/testserver"
|
||||
|
||||
"github.com/cucumber/godog"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
var sharedServer *testserver.Server
|
||||
@@ -19,6 +20,14 @@ func InitializeTestSuite(ctx *godog.TestSuiteContext) {
|
||||
|
||||
ctx.AfterSuite(func() {
|
||||
if sharedServer != nil {
|
||||
// Cleanup database after all tests
|
||||
if err := sharedServer.CleanupDatabase(); err != nil {
|
||||
log.Warn().Err(err).Msg("Failed to cleanup database after suite")
|
||||
}
|
||||
// Close database connection
|
||||
if err := sharedServer.CloseDatabase(); err != nil {
|
||||
log.Warn().Err(err).Msg("Failed to close database connection")
|
||||
}
|
||||
sharedServer.Stop()
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user