(t *testing.T, q *Queries)
| 14 | ) |
| 15 | |
| 16 | func runOnDeckQueries(t *testing.T, q *Queries) { |
| 17 | ctx := context.Background() |
| 18 | |
| 19 | city, err := q.CreateCity(ctx, CreateCityParams{ |
| 20 | Slug: "san-francisco", |
| 21 | Name: "San Francisco", |
| 22 | }) |
| 23 | if err != nil { |
| 24 | t.Fatal(err) |
| 25 | } |
| 26 | |
| 27 | venueID, err := q.CreateVenue(ctx, CreateVenueParams{ |
| 28 | Slug: "the-fillmore", |
| 29 | Name: "The Fillmore", |
| 30 | City: city.Slug, |
| 31 | SpotifyPlaylist: "spotify:uri", |
| 32 | Status: StatusOpen, |
| 33 | Statuses: []Status{StatusOpen, StatusClosed}, |
| 34 | Tags: []string{"rock", "punk"}, |
| 35 | }) |
| 36 | if err != nil { |
| 37 | t.Fatal(err) |
| 38 | } |
| 39 | |
| 40 | venue, err := q.GetVenue(ctx, GetVenueParams{ |
| 41 | Slug: "the-fillmore", |
| 42 | City: city.Slug, |
| 43 | }) |
| 44 | if err != nil { |
| 45 | t.Fatal(err) |
| 46 | } |
| 47 | |
| 48 | if diff := cmp.Diff(venue.ID, venueID); diff != "" { |
| 49 | t.Errorf("venue ID mismatch:\n%s", diff) |
| 50 | } |
| 51 | |
| 52 | { |
| 53 | actual, err := q.GetCity(ctx, city.Slug) |
| 54 | if err != nil { |
| 55 | t.Error(err) |
| 56 | } |
| 57 | if diff := cmp.Diff(actual, city); diff != "" { |
| 58 | t.Errorf("get city mismatch:\n%s", diff) |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | { |
| 63 | actual, err := q.VenueCountByCity(ctx) |
| 64 | if err != nil { |
| 65 | t.Error(err) |
| 66 | } |
| 67 | if diff := cmp.Diff(actual, []VenueCountByCityRow{ |
| 68 | {city.Slug, 1}, |
| 69 | }); diff != "" { |
| 70 | t.Errorf("venue county mismatch:\n%s", diff) |
| 71 | } |
| 72 | } |
| 73 |
no test coverage detected