From 4ca734cc1029e68fcefa6922021689a938251738 Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Thu, 8 Jan 2026 15:44:43 +0000 Subject: [PATCH] Remove failing bob_test files --- db/sql/trapcount_by_location_id.bob_test.go | 111 ------------------ ...trapdata_by_location_id_recent.bob_test.go | 103 ---------------- 2 files changed, 214 deletions(-) delete mode 100644 db/sql/trapcount_by_location_id.bob_test.go delete mode 100644 db/sql/trapdata_by_location_id_recent.bob_test.go diff --git a/db/sql/trapcount_by_location_id.bob_test.go b/db/sql/trapcount_by_location_id.bob_test.go deleted file mode 100644 index 6737508b..00000000 --- a/db/sql/trapcount_by_location_id.bob_test.go +++ /dev/null @@ -1,111 +0,0 @@ -// Code generated by BobGen psql v0.0.4-0.20260105020634-53e08d840e47+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package sql - -import ( - "context" - "fmt" - "strings" - "testing" - - "github.com/google/go-cmp/cmp" - "github.com/stephenafamo/bob" - "github.com/stephenafamo/bob/dialect/psql" - testutils "github.com/stephenafamo/bob/test/utils" -) - -func TestTrapCountByLocationID(t *testing.T) { - t.Run("Base", func(t *testing.T) { - var sb strings.Builder - - query := TrapCountByLocationID(random_int32(nil), []uuid.UUID{random_uuid_UUID(nil)}) - - if _, err := query.WriteQuery(t.Context(), &sb, 1); err != nil { - t.Fatal(err) - } - - if diff := cmp.Diff(trapCountByLocationIDSQL, sb.String()); diff != "" { - t.Fatalf("unexpected result (-got +want):\n%s", diff) - } - }) - - t.Run("Mod", func(t *testing.T) { - var sb strings.Builder - - query := TrapCountByLocationID(random_int32(nil), []uuid.UUID{random_uuid_UUID(nil)}) - - if _, err := psql.Select(query).WriteQuery(t.Context(), &sb, 1); err != nil { - t.Fatal(err) - } - - queryDiff, err := testutils.QueryDiff(trapCountByLocationIDSQL, sb.String(), formatQuery) - if err != nil { - t.Fatal(err) - } - if queryDiff != "" { - fmt.Println(sb.String()) - t.Fatalf("unexpected result (-got +want):\n%s", queryDiff) - } - }) - - t.Run("Scanning", func(t *testing.T) { - if testDB == nil { - t.Skip("skipping test, no DSN provided") - } - - ctxTx, cancel := context.WithCancel(t.Context()) - defer cancel() - - tx, err := testDB.Begin(ctxTx) - if err != nil { - t.Fatalf("Error starting transaction: %v", err) - } - - defer func() { - if err := tx.Rollback(ctxTx); err != nil { - t.Fatalf("Error rolling back transaction: %v", err) - } - }() - - query, args, err := bob.Build(ctxTx, psql.Select(TrapCountByLocationID(random_int32(nil), []uuid.UUID{random_uuid_UUID(nil)}))) - if err != nil { - t.Fatal(err) - } - - rows, err := tx.QueryContext(ctxTx, query, args...) - if err != nil { - t.Fatal(err) - } - defer rows.Close() - - columns, err := rows.Columns() - if err != nil { - t.Fatal(err) - } - - if len(columns) != 5 { - t.Fatalf("expected %d columns, got %d", 5, len(columns)) - } - - if columns[0] != "trapdata_globalid" { - t.Fatalf("expected column %d to be %s, got %s", 0, "trapdata_globalid", columns[0]) - } - - if columns[1] != "trapdata_enddate" { - t.Fatalf("expected column %d to be %s, got %s", 1, "trapdata_enddate", columns[1]) - } - - if columns[2] != "total_females" { - t.Fatalf("expected column %d to be %s, got %s", 2, "total_females", columns[2]) - } - - if columns[3] != "total_males" { - t.Fatalf("expected column %d to be %s, got %s", 3, "total_males", columns[3]) - } - - if columns[4] != "total" { - t.Fatalf("expected column %d to be %s, got %s", 4, "total", columns[4]) - } - }) -} diff --git a/db/sql/trapdata_by_location_id_recent.bob_test.go b/db/sql/trapdata_by_location_id_recent.bob_test.go deleted file mode 100644 index cb6a7042..00000000 --- a/db/sql/trapdata_by_location_id_recent.bob_test.go +++ /dev/null @@ -1,103 +0,0 @@ -// Code generated by BobGen psql v0.0.4-0.20260105020634-53e08d840e47+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package sql - -import ( - "context" - "fmt" - "strings" - "testing" - - "github.com/google/go-cmp/cmp" - "github.com/stephenafamo/bob" - "github.com/stephenafamo/bob/dialect/psql" - testutils "github.com/stephenafamo/bob/test/utils" -) - -func TestTrapDataByLocationIDRecent(t *testing.T) { - t.Run("Base", func(t *testing.T) { - var sb strings.Builder - - query := TrapDataByLocationIDRecent(random_int32(nil), []uuid.UUID{random_uuid_UUID(nil)}) - - if _, err := query.WriteQuery(t.Context(), &sb, 1); err != nil { - t.Fatal(err) - } - - if diff := cmp.Diff(trapDataByLocationIDRecentSQL, sb.String()); diff != "" { - t.Fatalf("unexpected result (-got +want):\n%s", diff) - } - }) - - t.Run("Mod", func(t *testing.T) { - var sb strings.Builder - - query := TrapDataByLocationIDRecent(random_int32(nil), []uuid.UUID{random_uuid_UUID(nil)}) - - if _, err := psql.Select(query).WriteQuery(t.Context(), &sb, 1); err != nil { - t.Fatal(err) - } - - queryDiff, err := testutils.QueryDiff(trapDataByLocationIDRecentSQL, sb.String(), formatQuery) - if err != nil { - t.Fatal(err) - } - if queryDiff != "" { - fmt.Println(sb.String()) - t.Fatalf("unexpected result (-got +want):\n%s", queryDiff) - } - }) - - t.Run("Scanning", func(t *testing.T) { - if testDB == nil { - t.Skip("skipping test, no DSN provided") - } - - ctxTx, cancel := context.WithCancel(t.Context()) - defer cancel() - - tx, err := testDB.Begin(ctxTx) - if err != nil { - t.Fatalf("Error starting transaction: %v", err) - } - - defer func() { - if err := tx.Rollback(ctxTx); err != nil { - t.Fatalf("Error rolling back transaction: %v", err) - } - }() - - query, args, err := bob.Build(ctxTx, psql.Select(TrapDataByLocationIDRecent(random_int32(nil), []uuid.UUID{random_uuid_UUID(nil)}))) - if err != nil { - t.Fatal(err) - } - - rows, err := tx.QueryContext(ctxTx, query, args...) - if err != nil { - t.Fatal(err) - } - defer rows.Close() - - columns, err := rows.Columns() - if err != nil { - t.Fatal(err) - } - - if len(columns) != 3 { - t.Fatalf("expected %d columns, got %d", 3, len(columns)) - } - - if columns[0] != "enddatetime" { - t.Fatalf("expected column %d to be %s, got %s", 0, "enddatetime", columns[0]) - } - - if columns[1] != "globalid" { - t.Fatalf("expected column %d to be %s, got %s", 1, "globalid", columns[1]) - } - - if columns[2] != "loc_id" { - t.Fatalf("expected column %d to be %s, got %s", 2, "loc_id", columns[2]) - } - }) -}