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