(t *testing.T, q *Queries)
| 30 | } |
| 31 | |
| 32 | func runOnDeckQueries(t *testing.T, q *Queries) { |
| 33 | ctx := context.Background() |
| 34 | |
| 35 | err := q.CreateCity(ctx, CreateCityParams{ |
| 36 | Slug: "san-francisco", |
| 37 | Name: "San Francisco", |
| 38 | }) |
| 39 | if err != nil { |
| 40 | t.Fatal(err) |
| 41 | } |
| 42 | |
| 43 | city, err := q.GetCity(ctx, "san-francisco") |
| 44 | if err != nil { |
| 45 | t.Fatal(err) |
| 46 | } |
| 47 | |
| 48 | venueResult, err := q.CreateVenue(ctx, CreateVenueParams{ |
| 49 | Slug: "the-fillmore", |
| 50 | Name: "The Fillmore", |
| 51 | City: city.Slug, |
| 52 | SpotifyPlaylist: "spotify:uri", |
| 53 | Status: VenuesStatusOpen, |
| 54 | Statuses: join(string(VenuesStatusOpen), string(VenuesStatusClosed)), |
| 55 | Tags: join("rock", "punk"), |
| 56 | }) |
| 57 | if err != nil { |
| 58 | t.Fatal(err) |
| 59 | } |
| 60 | venueID, err := venueResult.LastInsertId() |
| 61 | if err != nil { |
| 62 | t.Fatal(err) |
| 63 | } |
| 64 | |
| 65 | venue, err := q.GetVenue(ctx, GetVenueParams{ |
| 66 | Slug: "the-fillmore", |
| 67 | City: city.Slug, |
| 68 | }) |
| 69 | if err != nil { |
| 70 | t.Fatal(err) |
| 71 | } |
| 72 | |
| 73 | if diff := cmp.Diff(venue.ID, venueID); diff != "" { |
| 74 | t.Errorf("venue ID mismatch:\n%s", diff) |
| 75 | } |
| 76 | |
| 77 | { |
| 78 | actual, err := q.VenueCountByCity(ctx) |
| 79 | if err != nil { |
| 80 | t.Error(err) |
| 81 | } |
| 82 | if diff := cmp.Diff(actual, []VenueCountByCityRow{ |
| 83 | {city.Slug, int64(1)}, |
| 84 | }); diff != "" { |
| 85 | t.Errorf("venue count mismatch:\n%s", diff) |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | { |
no test coverage detected