package recommendation import ( "context" "strings" "testing" "github.com/jackc/pgx/v5/pgtype" ) // A section that panics fails the call with its stage named, as a query // error does, rather than stopping the server from a goroutine nobody // recovers. With no pool, every section's first query panics. func TestHomeData_APanickingSectionIsAnError(t *testing.T) { _, err := HomeData(context.Background(), nil, pgtype.UUID{Valid: true}) if err == nil { t.Fatal("HomeData with no pool: no error, want the panic as one") } if !strings.Contains(err.Error(), "panicked") { t.Errorf("err = %v, want it to say the section panicked", err) } }