-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(server): add coreSupport flag to project (#424)
- Loading branch information
1 parent
7604be6
commit dacc3d4
Showing
18 changed files
with
450 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package e2e | ||
|
||
import ( | ||
"net/http" | ||
"testing" | ||
|
||
"github.com/reearth/reearth/server/internal/app" | ||
) | ||
|
||
func TestMe(t *testing.T) { | ||
e := StartServer(t, &app.Config{ | ||
Origins: []string{"https://example.com"}, | ||
AuthSrv: app.AuthSrvConfig{ | ||
Disabled: true, | ||
}, | ||
}, | ||
true, baseSeeder) | ||
|
||
requestBody := GraphQLRequest{ | ||
OperationName: "GetMe", | ||
Query: "query GetMe { \n me { \n id \n name \n email\n } \n}", | ||
Variables: map[string]any{}, | ||
} | ||
|
||
e.POST("/api/graphql"). | ||
WithHeader("Origin", "https://example.com"). | ||
// WithHeader("authorization", "Bearer test"). | ||
WithHeader("X-Reearth-Debug-User", uId.String()). | ||
WithHeader("Content-Type", "application/json"). | ||
WithJSON(requestBody). | ||
Expect(). | ||
Status(http.StatusOK). | ||
JSON(). | ||
Object(). | ||
Value("data").Object(). | ||
Value("me").Object(). | ||
ValueEqual("email", uEmail). | ||
ValueEqual("id", uId.String()). | ||
ValueEqual("name", uName) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package e2e | ||
|
||
import ( | ||
"net/http" | ||
"testing" | ||
|
||
"github.com/reearth/reearth/server/internal/app" | ||
) | ||
|
||
func TestCreateProject(t *testing.T) { | ||
e := StartServer(t, &app.Config{ | ||
Origins: []string{"https://example.com"}, | ||
AuthSrv: app.AuthSrvConfig{ | ||
Disabled: true, | ||
}, | ||
}, | ||
true, baseSeeder) | ||
|
||
// create project with default coreSupport value (false) | ||
requestBody := GraphQLRequest{ | ||
OperationName: "CreateProject", | ||
Query: "mutation CreateProject($teamId: ID!, $visualizer: Visualizer!, $name: String!, $description: String!, $imageUrl: URL) {\n createProject(\n input: {teamId: $teamId, visualizer: $visualizer, name: $name, description: $description, imageUrl: $imageUrl}\n ) {\n project {\n id\n name\n description\n imageUrl\n coreSupport\n __typename\n }\n __typename\n }\n}", | ||
Variables: map[string]any{ | ||
"name": "test", | ||
"description": "abc", | ||
"imageUrl": "", | ||
"teamId": wId.String(), | ||
"visualizer": "CESIUM", | ||
}, | ||
} | ||
|
||
e.POST("/api/graphql"). | ||
WithHeader("Origin", "https://example.com"). | ||
// WithHeader("authorization", "Bearer test"). | ||
WithHeader("X-Reearth-Debug-User", uId.String()). | ||
WithHeader("Content-Type", "application/json"). | ||
WithJSON(requestBody). | ||
Expect(). | ||
Status(http.StatusOK). | ||
JSON(). | ||
Object(). | ||
Value("data").Object(). | ||
Value("createProject").Object(). | ||
Value("project").Object(). | ||
// ValueEqual("id", pId.String()). | ||
ValueEqual("name", "test"). | ||
ValueEqual("description", "abc"). | ||
ValueEqual("imageUrl", ""). | ||
ValueEqual("coreSupport", false) | ||
|
||
// create coreSupport project | ||
requestBody = GraphQLRequest{ | ||
OperationName: "CreateProject", | ||
Query: "mutation CreateProject($teamId: ID!, $visualizer: Visualizer!, $name: String!, $description: String!, $imageUrl: URL, $coreSupport: Boolean) {\n createProject(\n input: {teamId: $teamId, visualizer: $visualizer, name: $name, description: $description, imageUrl: $imageUrl, coreSupport: $coreSupport}\n ) {\n project {\n id\n name\n description\n imageUrl\n coreSupport\n __typename\n }\n __typename\n }\n}", | ||
Variables: map[string]any{ | ||
"name": "test", | ||
"description": "abc", | ||
"imageUrl": "", | ||
"teamId": wId.String(), | ||
"visualizer": "CESIUM", | ||
"coreSupport": true, | ||
}, | ||
} | ||
|
||
e.POST("/api/graphql"). | ||
WithHeader("Origin", "https://example.com"). | ||
// WithHeader("authorization", "Bearer test"). | ||
WithHeader("X-Reearth-Debug-User", uId.String()). | ||
WithHeader("Content-Type", "application/json"). | ||
WithJSON(requestBody). | ||
Expect(). | ||
Status(http.StatusOK). | ||
JSON(). | ||
Object(). | ||
Value("data").Object(). | ||
Value("createProject").Object(). | ||
Value("project").Object(). | ||
// ValueEqual("id", pId.String()). | ||
ValueEqual("name", "test"). | ||
ValueEqual("description", "abc"). | ||
ValueEqual("imageUrl", ""). | ||
ValueEqual("coreSupport", true) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,8 @@ import ( | |
|
||
var ( | ||
uId = user.NewID() | ||
uEmail = "[email protected]" | ||
uName = "e2e" | ||
wId = workspace.NewID() | ||
pId = id.NewProjectID() | ||
pAlias = "PROJECT_ALIAS" | ||
|
@@ -33,8 +35,8 @@ func baseSeeder(ctx context.Context, r *repo.Container) error { | |
u := user.New(). | ||
ID(uId). | ||
Workspace(wId). | ||
Name("e2e"). | ||
Email("[email protected]"). | ||
Name(uName). | ||
Email(uEmail). | ||
MustBuild() | ||
if err := r.User.Save(ctx, u); err != nil { | ||
return err | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.