Skip to content

Commit

Permalink
chore(server): add test for story block properties (#630)
Browse files Browse the repository at this point in the history
  • Loading branch information
yk-eukarya committed Aug 16, 2023
1 parent 75d5223 commit 562c51e
Show file tree
Hide file tree
Showing 2 changed files with 205 additions and 112 deletions.
44 changes: 44 additions & 0 deletions server/e2e/gql_property_test.go
@@ -0,0 +1,44 @@
package e2e

import (
"net/http"

"github.com/gavv/httpexpect/v2"
)

func updatePropertyValue(e *httpexpect.Expect, propertyID, schemaGroupID, itemID, fieldID string, value any, valueType any) (GraphQLRequest, *httpexpect.Value) {
requestBody := GraphQLRequest{
OperationName: "UpdatePropertyValue",
Query: `mutation UpdatePropertyValue($propertyId: ID!, $schemaGroupId: ID, $itemId: ID, $fieldId: ID!, $value: Any, $type: ValueType!) {
updatePropertyValue( input: { propertyId: $propertyId, schemaGroupId: $schemaGroupId, itemId: $itemId, fieldId: $fieldId, value: $value, type: $type } ) {
property {
id
}
propertyField {
id
type
value
}
}
}`,
Variables: map[string]any{
"propertyId": propertyID,
"schemaGroupId": schemaGroupID,
"itemId": itemID,
"fieldId": fieldID,
"value": value,
"type": valueType,
},
}

res := e.POST("/api/graphql").
WithHeader("Origin", "https://example.com").
WithHeader("X-Reearth-Debug-User", uID.String()).
WithHeader("Content-Type", "application/json").
WithJSON(requestBody).
Expect().
Status(http.StatusOK).
JSON()

return requestBody, res
}

0 comments on commit 562c51e

Please sign in to comment.