Skip to content

Commit

Permalink
chore: make test more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
rkettelerij committed Dec 30, 2024
1 parent 1c98539 commit f8b7ca7
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions internal/ogc/features/datasources/geopackage/geopackage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ func TestGeoPackage_GetFeatures(t *testing.T) {
wantFC *domain.FeatureCollection
wantCursor domain.Cursors
wantErr bool
wantGeom bool
}{
{
name: "get first page of features",
Expand Down Expand Up @@ -132,7 +133,8 @@ func TestGeoPackage_GetFeatures(t *testing.T) {
Prev: "|",
Next: "Dv4|", // 3838
},
wantErr: false,
wantGeom: true,
wantErr: false,
},
{
name: "get second page of features",
Expand Down Expand Up @@ -181,7 +183,8 @@ func TestGeoPackage_GetFeatures(t *testing.T) {
Prev: "|",
Next: "DwE|",
},
wantErr: false,
wantGeom: true,
wantErr: false,
},
{
name: "get first page of features with reference date",
Expand Down Expand Up @@ -225,7 +228,8 @@ func TestGeoPackage_GetFeatures(t *testing.T) {
Prev: "|",
Next: "Dv4|", // 3838
},
wantErr: false,
wantGeom: true,
wantErr: false,
},
{
name: "fail on non existing collection",
Expand Down Expand Up @@ -278,7 +282,8 @@ func TestGeoPackage_GetFeatures(t *testing.T) {
Prev: "|",
Next: "GSQ|",
},
wantErr: false,
wantGeom: false, // should be null
wantErr: false,
},
{
name: "get features with null geometry",
Expand Down Expand Up @@ -311,7 +316,8 @@ func TestGeoPackage_GetFeatures(t *testing.T) {
Prev: "DdY|",
Next: "|",
},
wantErr: false,
wantGeom: false, // should be null
wantErr: false,
},
}
for _, tt := range tests {
Expand All @@ -337,6 +343,9 @@ func TestGeoPackage_GetFeatures(t *testing.T) {
for i, wantedFeature := range tt.wantFC.Features {
assert.Equal(t, wantedFeature.Properties.Value("straatnaam"), fc.Features[i].Properties.Value("straatnaam"))
assert.Equal(t, wantedFeature.Properties.Value("nummer_id"), fc.Features[i].Properties.Value("nummer_id"))
if !tt.wantGeom {
assert.Nil(t, fc.Features[i].Geometry)
}
}
assert.Equal(t, tt.wantCursor.Prev, cursor.Prev)
assert.Equal(t, tt.wantCursor.Next, cursor.Next)
Expand Down

0 comments on commit f8b7ca7

Please sign in to comment.