diff --git a/server/testing/factory/auth.go b/server/testing/factory/auth.go index 6eccab3f..9a5c5582 100644 --- a/server/testing/factory/auth.go +++ b/server/testing/factory/auth.go @@ -46,11 +46,9 @@ func (f *Factory) NewAuth(opts ...AuthOpt) *orm.Auth { opt(m) } - boil.DebugMode = f.debug if err = m.Insert(context.Background(), f.db, boil.Infer()); err != nil { panic(fmt.Errorf("failed to insert user: %w", err)) } - boil.DebugMode = false return m } diff --git a/server/testing/factory/exercise.go b/server/testing/factory/exercise.go index 830a8752..e91cc6ca 100644 --- a/server/testing/factory/exercise.go +++ b/server/testing/factory/exercise.go @@ -41,11 +41,9 @@ func (f *Factory) NewExercise(opts ...ExerciseOpt) *orm.Exercise { m.UserID = f.NewUser().ID } - boil.DebugMode = f.debug if err := m.Insert(context.Background(), f.db, boil.Infer()); err != nil { panic(fmt.Errorf("failed to insert exercise: %w", err)) } - boil.DebugMode = false user, err := m.User().One(context.Background(), f.db) if err != nil { diff --git a/server/testing/factory/factory.go b/server/testing/factory/factory.go index da11392d..158959f5 100644 --- a/server/testing/factory/factory.go +++ b/server/testing/factory/factory.go @@ -12,14 +12,12 @@ import ( type Factory struct { db *sql.DB faker *gofakeit.Faker - debug bool } func NewFactory(db *sql.DB) *Factory { return &Factory{ db: db, faker: gofakeit.New(0), - debug: false, } } diff --git a/server/testing/factory/notification.go b/server/testing/factory/notification.go index 13fea0d7..215d54bb 100644 --- a/server/testing/factory/notification.go +++ b/server/testing/factory/notification.go @@ -53,11 +53,9 @@ func (f *Factory) NewNotification(opts ...NotificationOpt) *orm.Notification { m.Payload = []byte("{}") } - boil.DebugMode = f.debug if err := m.Insert(context.Background(), f.db, boil.Infer()); err != nil { panic(fmt.Errorf("failed to insert notification: %w", err)) } - boil.DebugMode = false user, err := m.User().One(context.Background(), f.db) if err != nil { diff --git a/server/testing/factory/routine.go b/server/testing/factory/routine.go index c857f675..e3113515 100644 --- a/server/testing/factory/routine.go +++ b/server/testing/factory/routine.go @@ -42,11 +42,9 @@ func (f *Factory) NewRoutine(opts ...RoutineOpt) *orm.Routine { m.UserID = f.NewUser().ID } - boil.DebugMode = f.debug if err := m.Insert(context.Background(), f.db, boil.Infer()); err != nil { panic(fmt.Errorf("failed to insert routine: %w", err)) } - boil.DebugMode = false user, err := m.User().One(context.Background(), f.db) if err != nil { @@ -89,9 +87,7 @@ func RoutineExerciseOrder(exerciseIDs []string) RoutineOpt { } func (f *Factory) AddRoutineExercise(routine *orm.Routine, exercises ...*orm.Exercise) { - boil.DebugMode = f.debug if err := routine.AddExercises(context.Background(), f.db, false, exercises...); err != nil { panic(fmt.Errorf("failed to add exercises to routine: %w", err)) } - boil.DebugMode = false } diff --git a/server/testing/factory/set.go b/server/testing/factory/set.go index 3678ebb2..c16e4fe7 100644 --- a/server/testing/factory/set.go +++ b/server/testing/factory/set.go @@ -57,11 +57,9 @@ func (f *Factory) NewSet(opts ...SetOpt) *orm.Set { m.ExerciseID = f.NewExercise().ID } - boil.DebugMode = f.debug if err := m.Insert(context.Background(), f.db, boil.Infer()); err != nil { panic(fmt.Errorf("failed to insert set: %w", err)) } - boil.DebugMode = false workout, err := m.Workout().One(context.Background(), f.db) if err != nil { diff --git a/server/testing/factory/user.go b/server/testing/factory/user.go index 723b0ebe..9f9305ca 100644 --- a/server/testing/factory/user.go +++ b/server/testing/factory/user.go @@ -37,11 +37,9 @@ func (f *Factory) NewUser(opts ...UserOpt) *orm.User { m.AuthID = f.NewAuth().ID } - boil.DebugMode = f.debug if err := m.Insert(context.Background(), f.db, boil.Infer()); err != nil { panic(fmt.Errorf("failed to insert user: %w", err)) } - boil.DebugMode = false auth, err := m.Auth().One(context.Background(), f.db) if err != nil { diff --git a/server/testing/factory/workout.go b/server/testing/factory/workout.go index 95317833..39580cd1 100644 --- a/server/testing/factory/workout.go +++ b/server/testing/factory/workout.go @@ -41,11 +41,9 @@ func (f *Factory) NewWorkout(opts ...WorkoutOpt) *orm.Workout { m.UserID = f.NewUser().ID } - boil.DebugMode = f.debug if err := m.Insert(context.Background(), f.db, boil.Infer()); err != nil { panic(fmt.Errorf("failed to insert workout: %w", err)) } - boil.DebugMode = false user, err := m.User().One(context.Background(), f.db) if err != nil { @@ -115,11 +113,9 @@ func (f *Factory) NewWorkoutComment(opts ...WorkoutCommentOpt) *orm.WorkoutComme m.WorkoutID = f.NewWorkout().ID } - boil.DebugMode = f.debug if err := m.Insert(context.Background(), f.db, boil.Infer()); err != nil { panic(fmt.Errorf("failed to insert workout comment: %w", err)) } - boil.DebugMode = false user, err := m.User().One(context.Background(), f.db) if err != nil {