diff --git a/tests/img.png b/tests/img.png new file mode 100644 index 0000000..5c273c7 Binary files /dev/null and b/tests/img.png differ diff --git a/tests/scheduling_test.go b/tests/scheduling_test.go index f6b04fa..fd40b4a 100644 --- a/tests/scheduling_test.go +++ b/tests/scheduling_test.go @@ -2,9 +2,11 @@ package tests import ( "fmt" + "os" "testing" "time" + "github.com/99designs/gqlgen/graphql" "github.com/stadio-app/stadio-backend/database/jet/postgres/public/model" "github.com/stadio-app/stadio-backend/graph/gmodel" ) @@ -60,6 +62,11 @@ func TestLocation(t *testing.T) { } var location gmodel.Location + file, err := os.Open("./img.png") + if err != nil { + t.Fatal(err) + } + t.Run("create location", func(t *testing.T) { input := gmodel.CreateLocation{ Name: "My Soccer Field", @@ -77,6 +84,16 @@ func TestLocation(t *testing.T) { Instances: []*gmodel.CreateLocationInstance{ {Name: "Field #1"}, }, + Images: []*gmodel.CreateLocationImage{ + { + File: graphql.Upload{ + File: file, + Filename: file.Name(), + ContentType: "image/png", + }, + Default: true, + }, + }, } if location, err = service.CreateLocation(ctx, &user, input); err != nil { t.Fatal(err.Error()) @@ -333,6 +350,16 @@ func TestLocation(t *testing.T) { }, Schedule: init_schedule(7, 20, true), // 7am - 8pm Instances: init_location_instances(num_instances), + Images: []*gmodel.CreateLocationImage{ + { + File: graphql.Upload{ + File: file, + Filename: file.Name(), + ContentType: "image/png", + }, + Default: true, + }, + }, }) if err != nil { t.Fatal("could not create complex location")