- Add expired JWT token scenario - Add wrong secret JWT token scenario - Add malformed JWT token scenario - Implement /api/v1/auth/validate endpoint - Add JWT parsing and validation to BDD steps Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
40 lines
951 B
Go
40 lines
951 B
Go
package bdd
|
|
|
|
import (
|
|
"dance-lessons-coach/pkg/bdd/steps"
|
|
"dance-lessons-coach/pkg/bdd/testserver"
|
|
|
|
"github.com/cucumber/godog"
|
|
"github.com/rs/zerolog/log"
|
|
)
|
|
|
|
var sharedServer *testserver.Server
|
|
|
|
func InitializeTestSuite(ctx *godog.TestSuiteContext) {
|
|
ctx.BeforeSuite(func() {
|
|
sharedServer = testserver.NewServer()
|
|
if err := sharedServer.Start(); err != nil {
|
|
panic(err)
|
|
}
|
|
})
|
|
|
|
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()
|
|
}
|
|
})
|
|
}
|
|
|
|
func InitializeScenario(ctx *godog.ScenarioContext) {
|
|
client := testserver.NewClient(sharedServer)
|
|
steps.InitializeAllSteps(ctx, client)
|
|
}
|