-
Notifications
You must be signed in to change notification settings - Fork 0
Talbot support setProjectLocation endpoint by adding appropriate tests #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,9 +2,14 @@ package org.justserve | |
|
|
||
| import io.micronaut.test.extensions.spock.annotation.MicronautTest | ||
| import jakarta.inject.Inject | ||
| import net.datafaker.Faker | ||
| import org.justserve.client.GraphQLClient | ||
| import org.justserve.model.EventType | ||
| import org.justserve.model.GraphQLCreateProjectData | ||
| import org.justserve.model.GraphQLCreateProjectVariables | ||
| import org.justserve.model.GraphQLResponse | ||
| import org.justserve.model.GraphQLSetProjectLocationVariables | ||
| import org.justserve.model.GraphQLSetProjectLocationVariablesLocationData | ||
| import org.justserve.model.ProjectLocationType | ||
| import spock.lang.Shared | ||
| import spock.lang.Specification | ||
|
|
@@ -16,6 +21,18 @@ class GraphQLClientSpec extends Specification { | |
| @Inject | ||
| GraphQLClient client | ||
|
|
||
| @Shared | ||
| GraphQLResponse<GraphQLCreateProjectData> projectData | ||
|
|
||
| def setupSpec() { | ||
| GraphQLCreateProjectVariables createProjectArgs = new GraphQLCreateProjectVariables() | ||
| .setEventType(EventType.DTL) | ||
| .setLocationType(ProjectLocationType.SINGLE_LOCATION) | ||
| .setTitle("this is my title") | ||
| .setRedirect("https://google.com") | ||
| projectData = client.createProject(createProjectArgs) | ||
| } | ||
|
|
||
| void "can create Project with EventType: #eventType, LocationType: #locationType, and Redirect: #redirect"(EventType eventType, ProjectLocationType locationType, String redirect) { | ||
| given: | ||
| GraphQLCreateProjectVariables args = new GraphQLCreateProjectVariables() | ||
|
|
@@ -26,11 +43,45 @@ class GraphQLClientSpec extends Specification { | |
|
|
||
| when: | ||
| client.createProject(args) | ||
|
|
||
| then: | ||
| noExceptionThrown() | ||
|
|
||
| where: | ||
| [eventType, locationType, redirect] << [EventType.values(), ProjectLocationType.values(), ["", null, "https://google.com"]].combinations() | ||
| } | ||
|
|
||
| void "can set project location using Project Id: #projectId, Location: #location, Location Data: #locationData"(UUID projectId, String location, GraphQLSetProjectLocationVariablesLocationData locationData) { | ||
| given: | ||
| GraphQLSetProjectLocationVariables addAttachmentArgs = new GraphQLSetProjectLocationVariables() | ||
| .setProjectId(projectId) | ||
| .setLocation(location) | ||
| .setLocationData(locationData) | ||
|
|
||
| when: | ||
|
|
||
| client.setProjectLocation(addAttachmentArgs) | ||
|
|
||
| then: | ||
| noExceptionThrown() | ||
|
|
||
| where: | ||
| // TODO: Replace hardcoded values to make this a bit more dynamic | ||
| [projectId, location, locationData] << [projectData.data.createProject.id, ["20 West 6th Street, Tempe, Arizona, United States", null, ""], [null, new GraphQLSetProjectLocationVariablesLocationData() | ||
| .setAddress("20 West 6th Street") | ||
| .setAreaId("790052") | ||
| .setCcId("543306") | ||
| .setCity("Tempe") | ||
| .setCountry("United States") | ||
| .setCountryCode("us") | ||
| .setCounty("Maricopa County") | ||
| .setLocationDetails("") | ||
| .setLocationName("20 West 6th Street, Tempe, Arizona, United States") | ||
| .setLatitude(33.4245772) | ||
| .setLongitude(-111.9410241) | ||
| .setMissionId("2011050") | ||
| .setPostal("85281") | ||
| .setStakeId("504297") | ||
| .setState("Arizona") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we're rolling this out across several hundred projects, let's replace this hard-coded address with a 30 real locations. let's add those in a json file for now in the resources directory. Let's ensure the sample includes the US and Canada for now, and that it varies whether it includes optional fields like AreaId or StakeId. |
||
| ]].combinations() | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't modify code outside of your scope of work - refactoring whitespace like this adds noise to commits