Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
7ebc88a
fix: update reearthx
wilfredmulenga Dec 12, 2025
5ce8c53
fix: update package and fix lint
wilfredmulenga Dec 12, 2025
fd6a869
fix: update package
wilfredmulenga Dec 12, 2025
c0553e7
Refactors tests and adds shapefile test coverage
wilfredmulenga Dec 14, 2025
4094d66
Fix test assertions for theme case-sensitivity and cloning logic
wilfredmulenga Dec 15, 2025
d4a2f4a
Fix assertion to compare pointer addresses in tests
wilfredmulenga Dec 15, 2025
1314990
Fix error formatting and enhance shapefile test coverage
wilfredmulenga Dec 15, 2025
1d9497b
Ensure JSON responses include proper content type and fix test assert…
wilfredmulenga Dec 15, 2025
d5ddf26
Fix test assertions to ensure pointer comparison
wilfredmulenga Dec 15, 2025
8bd1b4b
Fixes incorrect reference checks in clone unit tests
wilfredmulenga Dec 15, 2025
65c6108
fix: upgrade dependencies
wilfredmulenga Dec 15, 2025
51b4c95
fix: lint issues
wilfredmulenga Dec 15, 2025
c209e0f
fix: remove backup file
wilfredmulenga Dec 15, 2025
7b109ce
Refactors tests, updates dependencies, and improves code clarity
wilfredmulenga Dec 15, 2025
8805d6f
Add linter configuration and update dependencies
wilfredmulenga Dec 16, 2025
03a8bec
fix: remove golangci-lint config file
wilfredmulenga Dec 16, 2025
af7d9c3
Remove testing short-mode skips in server startup functions
wilfredmulenga Dec 16, 2025
a9ba279
Fix layer removal logic for group-linked parent layers
wilfredmulenga Dec 16, 2025
2b47f28
Fix null pointer checks for infobox and story block removals
wilfredmulenga Dec 16, 2025
6a88bed
Handle null and empty array cases for infobox block validation
wilfredmulenga Dec 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci_server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
go-version-file: 'server/go.mod'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
uses: golangci/golangci-lint-action@v9
with:
version: v1.55
version: v2.5.0
args: --timeout=10m
working-directory: server

Expand Down
2 changes: 1 addition & 1 deletion go.work
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
go 1.21
go 1.24.2

use ./server
149 changes: 144 additions & 5 deletions go.work.sum

Large diffs are not rendered by default.

10 changes: 0 additions & 10 deletions server/.golangci.yml

This file was deleted.

2 changes: 1 addition & 1 deletion server/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
lint:
golangci-lint run --fix
docker run --rm -v $(shell pwd):/app -w /app golangci/golangci-lint:v2.5.0-alpine golangci-lint run --timeout=10m

test:
go test -race -short -v ./...
Expand Down
14 changes: 3 additions & 11 deletions server/e2e/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net/http"
"testing"

"github.com/gavv/httpexpect/v2"
httpexpect "github.com/gavv/httpexpect/v2"
"github.com/reearth/reearth/server/internal/app"
"github.com/reearth/reearth/server/internal/app/config"
"github.com/reearth/reearth/server/internal/infrastructure/fs"
Expand Down Expand Up @@ -69,10 +69,6 @@ func StartServerAndRepos(t *testing.T, cfg *config.Config, useMongo bool, seeder
func StartServerWithRepos(t *testing.T, cfg *config.Config, repos *repo.Container, gateways *gateway.Container) *httpexpect.Expect {
t.Helper()

if testing.Short() {
t.Skip("skipping test in short mode.")
}

ctx := context.Background()

l, err := net.Listen("tcp", ":0")
Expand Down Expand Up @@ -106,7 +102,7 @@ func StartServerWithRepos(t *testing.T, cfg *config.Config, repos *repo.Containe
}
})

return httpexpect.New(t, "http://"+l.Addr().String())
return httpexpect.Default(t, "http://"+l.Addr().String())
}

type GraphQLRequest struct {
Expand Down Expand Up @@ -143,10 +139,6 @@ func StartGQLServerRepos(t *testing.T, seeder Seeder) (*httpexpect.Expect, conte
func StartGQLServerWithRepos(t *testing.T, ctx context.Context, cfg *config.Config, repos *repo.Container, accountrepos *accountrepo.Container) *httpexpect.Expect {
t.Helper()

if testing.Short() {
t.SkipNow()
}

l, err := net.Listen("tcp", ":0")
if err != nil {
t.Fatalf("server failed to listen: %v", err)
Expand Down Expand Up @@ -181,5 +173,5 @@ func StartGQLServerWithRepos(t *testing.T, ctx context.Context, cfg *config.Conf
t.Fatalf("server serve: %v", err)
}
})
return httpexpect.New(t, "http://"+l.Addr().String())
return httpexpect.Default(t, "http://"+l.Addr().String())
}
18 changes: 9 additions & 9 deletions server/e2e/dataset_export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,26 @@ func TestDatasetExport(t *testing.T) {
WithHeader("X-Reearth-Debug-User", uID.String()).
Expect().
Status(http.StatusOK).
ContentType("text/csv")
res.Header("Content-Disposition").Equal("attachment;filename=test.csv")
res.Body().Equal(",f1,f2,f3,location_lng,location_lat\n" + dsID.String() + ",test,123,true,12.000000,11.000000\n")
HasContentType("text/csv")
res.Header("Content-Disposition").IsEqual("attachment;filename=test.csv")
res.Body().IsEqual(",f1,f2,f3,location_lng,location_lat\n" + dsID.String() + ",test,123,true,12.000000,11.000000\n")

res = e.GET("/api/datasets/{}.csv", dssID).
WithHeader("X-Reearth-Debug-User", uID.String()).
Expect().
Status(http.StatusOK).
ContentType("text/csv")
res.Header("Content-Disposition").Equal("attachment;filename=test.csv")
res.Body().Equal(",f1,f2,f3,location_lng,location_lat\n" + dsID.String() + ",test,123,true,12.000000,11.000000\n")
HasContentType("text/csv")
res.Header("Content-Disposition").IsEqual("attachment;filename=test.csv")
res.Body().IsEqual(",f1,f2,f3,location_lng,location_lat\n" + dsID.String() + ",test,123,true,12.000000,11.000000\n")

res = e.GET("/api/datasets/{}.json", dssID).
WithHeader("X-Reearth-Debug-User", uID.String()).
Expect().
Status(http.StatusOK).
ContentType("application/json")
res.Header("Content-Disposition").Equal("attachment;filename=test.csv.json")
HasContentType("application/json")
res.Header("Content-Disposition").IsEqual("attachment;filename=test.csv.json")

res.JSON().Equal(map[string]any{
res.JSON().IsEqual(map[string]any{
"schema": map[string]any{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "#/schemas/" + dssID.String(),
Expand Down
68 changes: 34 additions & 34 deletions server/e2e/gql_asset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,16 @@ func TestGetAssetsKeyword(t *testing.T) {
}
res := GetAssets(e, uID.String(), variables)
if i < 1 {
res.Object().Value("edges").Array().Length().Equal(limit)
res.Object().Value("edges").Array().Length().IsEqual(limit)
} else {
res.Object().Value("edges").Array().Length().Equal(9)
res.Object().Value("edges").Array().Length().IsEqual(9)
}
res.Object().Value("pageInfo").Object().ValueEqual("hasNextPage", false)
res.Object().ValueEqual("totalCount", 19)
res.Object().Value("pageInfo").Object().HasValue("hasNextPage", false)
res.Object().HasValue("totalCount", 19)
if i < 1 {
res.Object().Value("pageInfo").Object().ValueEqual("hasPreviousPage", true)
res.Object().Value("pageInfo").Object().HasValue("hasPreviousPage", true)
} else {
res.Object().Value("pageInfo").Object().ValueEqual("hasPreviousPage", false)
res.Object().Value("pageInfo").Object().HasValue("hasPreviousPage", false)
}
endCursor = res.Path("$.pageInfo.endCursor").Raw().(string)
}
Expand All @@ -181,16 +181,16 @@ func TestGetAssetsKeyword(t *testing.T) {

res := GetAssets(e, uID.String(), variables)
if i < 1 {
res.Object().Value("edges").Array().Length().Equal(limit)
res.Object().Value("edges").Array().Length().IsEqual(limit)
} else {
res.Object().Value("edges").Array().Length().Equal(9)
res.Object().Value("edges").Array().Length().IsEqual(9)
}
res.Object().Value("pageInfo").Object().ValueEqual("hasPreviousPage", false)
res.Object().ValueEqual("totalCount", 19)
res.Object().Value("pageInfo").Object().HasValue("hasPreviousPage", false)
res.Object().HasValue("totalCount", 19)
if i < 1 {
res.Object().Value("pageInfo").Object().ValueEqual("hasNextPage", true)
res.Object().Value("pageInfo").Object().HasValue("hasNextPage", true)
} else {
res.Object().Value("pageInfo").Object().ValueEqual("hasNextPage", false)
res.Object().Value("pageInfo").Object().HasValue("hasNextPage", false)
}
endCursor = res.Path("$.pageInfo.endCursor").Raw().(string)
}
Expand Down Expand Up @@ -219,16 +219,16 @@ func TestGetAssetsLmit30(t *testing.T) {
}
res := GetAssets(e, uID.String(), variables)
if i < 3 {
res.Object().Value("edges").Array().Length().Equal(limit)
res.Object().Value("edges").Array().Length().IsEqual(limit)
} else {
res.Object().Value("edges").Array().Length().Equal(10)
res.Object().Value("edges").Array().Length().IsEqual(10)
}
res.Object().Value("pageInfo").Object().ValueEqual("hasNextPage", false)
res.Object().ValueEqual("totalCount", testDataCount)
res.Object().Value("pageInfo").Object().HasValue("hasNextPage", false)
res.Object().HasValue("totalCount", testDataCount)
if i < 3 {
res.Object().Value("pageInfo").Object().ValueEqual("hasPreviousPage", true)
res.Object().Value("pageInfo").Object().HasValue("hasPreviousPage", true)
} else {
res.Object().Value("pageInfo").Object().ValueEqual("hasPreviousPage", false)
res.Object().Value("pageInfo").Object().HasValue("hasPreviousPage", false)
}
endCursor = res.Path("$.pageInfo.endCursor").Raw().(string)
}
Expand All @@ -247,16 +247,16 @@ func TestGetAssetsLmit30(t *testing.T) {

res := GetAssets(e, uID.String(), variables)
if i < 3 {
res.Object().Value("edges").Array().Length().Equal(limit)
res.Object().Value("edges").Array().Length().IsEqual(limit)
} else {
res.Object().Value("edges").Array().Length().Equal(10)
res.Object().Value("edges").Array().Length().IsEqual(10)
}
res.Object().Value("pageInfo").Object().ValueEqual("hasPreviousPage", false)
res.Object().ValueEqual("totalCount", testDataCount)
res.Object().Value("pageInfo").Object().HasValue("hasPreviousPage", false)
res.Object().HasValue("totalCount", testDataCount)
if i < 3 {
res.Object().Value("pageInfo").Object().ValueEqual("hasNextPage", true)
res.Object().Value("pageInfo").Object().HasValue("hasNextPage", true)
} else {
res.Object().Value("pageInfo").Object().ValueEqual("hasNextPage", false)
res.Object().Value("pageInfo").Object().HasValue("hasNextPage", false)
}
endCursor = res.Path("$.pageInfo.endCursor").Raw().(string)
}
Expand All @@ -269,13 +269,13 @@ func checkGetAssetsASC(e *httpexpect.Expect, variables map[string]any, limit int
variables["pagination"].(map[string]any)["before"] = endCursor // set cursor
}
res := GetAssets(e, uID.String(), variables)
res.Object().Value("edges").Array().Length().Equal(limit)
res.Object().Value("pageInfo").Object().ValueEqual("hasNextPage", false)
res.Object().ValueEqual("totalCount", testDataCount)
res.Object().Value("edges").Array().Length().IsEqual(limit)
res.Object().Value("pageInfo").Object().HasValue("hasNextPage", false)
res.Object().HasValue("totalCount", testDataCount)
if i < testDataCount/limit-1 { // last
res.Object().Value("pageInfo").Object().ValueEqual("hasPreviousPage", true)
res.Object().Value("pageInfo").Object().HasValue("hasPreviousPage", true)
} else {
res.Object().Value("pageInfo").Object().ValueEqual("hasPreviousPage", false)
res.Object().Value("pageInfo").Object().HasValue("hasPreviousPage", false)
}
endCursor = res.Path("$.pageInfo.endCursor").Raw().(string)
}
Expand All @@ -289,13 +289,13 @@ func checkGetAssetsDESC(e *httpexpect.Expect, variables map[string]any, limit in
}

res := GetAssets(e, uID.String(), variables)
res.Object().Value("edges").Array().Length().Equal(limit)
res.Object().Value("pageInfo").Object().ValueEqual("hasPreviousPage", false)
res.Object().ValueEqual("totalCount", testDataCount)
res.Object().Value("edges").Array().Length().IsEqual(limit)
res.Object().Value("pageInfo").Object().HasValue("hasPreviousPage", false)
res.Object().HasValue("totalCount", testDataCount)
if i < testDataCount/limit-1 { // last
res.Object().Value("pageInfo").Object().ValueEqual("hasNextPage", true)
res.Object().Value("pageInfo").Object().HasValue("hasNextPage", true)
} else {
res.Object().Value("pageInfo").Object().ValueEqual("hasNextPage", false)
res.Object().Value("pageInfo").Object().HasValue("hasNextPage", false)
}
endCursor = res.Path("$.pageInfo.endCursor").Raw().(string)
}
Expand Down
20 changes: 10 additions & 10 deletions server/e2e/gql_dataset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ func checkGetDatasetsASC(e *httpexpect.Expect, variables map[string]any, limit i
}
res := GetDatasets(e, uID.String(), variables)
// ValueDump(res)
res.Object().Value("edges").Array().Length().Equal(limit)
res.Object().Value("pageInfo").Object().ValueEqual("hasNextPage", false)
res.Object().ValueEqual("totalCount", testDataCount)
res.Object().Value("edges").Array().Length().IsEqual(limit)
res.Object().Value("pageInfo").Object().HasValue("hasNextPage", false)
res.Object().HasValue("totalCount", testDataCount)
if i < testDataCount/limit-1 { // last
res.Object().Value("pageInfo").Object().ValueEqual("hasPreviousPage", true)
res.Object().Value("pageInfo").Object().HasValue("hasPreviousPage", true)
} else {
res.Object().Value("pageInfo").Object().ValueEqual("hasPreviousPage", false)
res.Object().Value("pageInfo").Object().HasValue("hasPreviousPage", false)
}
endCursor = res.Path("$.pageInfo.endCursor").Raw().(string)
}
Expand All @@ -94,13 +94,13 @@ func checkGetDatasetsDESC(e *httpexpect.Expect, variables map[string]any, limit
}

res := GetDatasets(e, uID.String(), variables)
res.Object().Value("edges").Array().Length().Equal(limit)
res.Object().Value("pageInfo").Object().ValueEqual("hasPreviousPage", false)
res.Object().ValueEqual("totalCount", testDataCount)
res.Object().Value("edges").Array().Length().IsEqual(limit)
res.Object().Value("pageInfo").Object().HasValue("hasPreviousPage", false)
res.Object().HasValue("totalCount", testDataCount)
if i < testDataCount/limit-1 { // last
res.Object().Value("pageInfo").Object().ValueEqual("hasNextPage", true)
res.Object().Value("pageInfo").Object().HasValue("hasNextPage", true)
} else {
res.Object().Value("pageInfo").Object().ValueEqual("hasNextPage", false)
res.Object().Value("pageInfo").Object().HasValue("hasNextPage", false)
}
endCursor = res.Path("$.pageInfo.endCursor").Raw().(string)
}
Expand Down
Loading
Loading