Skip to content

Commit

Permalink
fix ut format to add paralel
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkarel committed Nov 26, 2024
1 parent 29ca006 commit e86d83e
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 20 deletions.
17 changes: 7 additions & 10 deletions server/pkg/asset/file_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package asset

import (
"reflect"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -93,10 +92,9 @@ func TestFile_Files(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
flatten := tt.files.FlattenChildren()
if !reflect.DeepEqual(flatten, tt.want) {
t.Errorf("expected %v, got %v", tt.want, flatten)
}
assert.Equal(t, flatten, tt.want)
})
}
}
Expand Down Expand Up @@ -246,10 +244,9 @@ func Test_File_RootPath(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
result := tt.file.RootPath(tt.uuid)
if result != tt.want {
t.Errorf("expected %q, got %q", tt.want, result)
}
assert.Equal(t, result, tt.want)
})
}
}
Expand Down Expand Up @@ -291,15 +288,15 @@ func Test_Clone(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
cloned := tt.file.Clone()
if !reflect.DeepEqual(cloned, tt.want) {
t.Errorf("expected %v, got %v", tt.want, cloned)
}
assert.Equal(t, cloned, tt.want)
})
}
}

func Test_FilePath(t *testing.T) {
t.Parallel()
assert.Equal(t,
[]string{
"/hello/c.txt",
Expand Down
1 change: 1 addition & 0 deletions server/pkg/asset/preview_type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,5 +322,6 @@ func TestPreviewType_StringRef(t *testing.T) {
}

func TestPreviewType_Prev(t *testing.T) {
t.Parallel()
assert.Equal(t, func() *PreviewType { pt := PreviewType("image"); return &pt }(), PreviewTypeImage.Ref())
}
2 changes: 1 addition & 1 deletion server/pkg/asset/upload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func TestUpload_Upload(t *testing.T) {

t.Parallel()
projectID := NewProjectID()
timeNow := time.Now()
uploadWithData := &Upload{
Expand Down
10 changes: 3 additions & 7 deletions server/pkg/integrationapi/asset_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package integrationapi

import (
"reflect"
"testing"
"time"

Expand Down Expand Up @@ -109,11 +108,10 @@ func Test_NewAsset(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
result := NewAsset(tt.a, tt.f, tt.url, tt.all)

if !reflect.DeepEqual(result, tt.want) {
t.Errorf("want %+v, got %+v", tt.want, result)
}
assert.Equal(t, result, tt.want)
})
}
}
Expand Down Expand Up @@ -160,9 +158,7 @@ func TestToAssetArchiveExtractionStatus(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
result := ToAssetArchiveExtractionStatus(tt.input)
if !reflect.DeepEqual(result, tt.expected) {
t.Errorf("ToAssetArchiveExtractionStatus() expected %v, got %v", tt.expected, result)
}
assert.Equal(t, result, tt.expected)
})
}
}
Expand Down
1 change: 1 addition & 0 deletions server/pkg/integrationapi/comment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func TestNewComment(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
result := NewComment(tt.input)
assert.Equal(t, tt.expected, result)
})
Expand Down
17 changes: 15 additions & 2 deletions server/pkg/integrationapi/item_export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,46 +18,58 @@ import (

func TestToGeometryType(t *testing.T) {
tests := []struct {
name string
input *exporters.GeometryType
expected *GeometryType
}{
{
name: "success type point",
input: lo.ToPtr(exporters.GeometryTypePoint),
expected: lo.ToPtr(GeometryTypePoint),
},
{
name: "success type multi point",
input: lo.ToPtr(exporters.GeometryTypeMultiPoint),
expected: lo.ToPtr(GeometryTypeMultiPoint),
},
{
name: "success type line string",
input: lo.ToPtr(exporters.GeometryTypeLineString),
expected: lo.ToPtr(GeometryTypeLineString),
},
{
name: "success type multi line string",
input: lo.ToPtr(exporters.GeometryTypeMultiLineString),
expected: lo.ToPtr(GeometryTypeMultiLineString),
},
{
name: "success type polygon",
input: lo.ToPtr(exporters.GeometryTypePolygon),
expected: lo.ToPtr(GeometryTypePolygon),
},
{
name: "success type multi polygon",
input: lo.ToPtr(exporters.GeometryTypeMultiPolygon),
expected: lo.ToPtr(GeometryTypeMultiPolygon),
},
{
name: "success type geometry collection",
input: lo.ToPtr(exporters.GeometryTypeGeometryCollection),
expected: lo.ToPtr(GeometryTypeGeometryCollection),
},
{
name: "success nil",
input: nil,
expected: nil,
},
}

for _, tt := range tests {
result := toGeometryType(tt.input)
assert.Equal(t, tt.expected, result, "For input %v, expected %v but got %v", tt.input, tt.expected, result)
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
result := toGeometryType(tt.input)
assert.Equal(t, tt.expected, result)
})
}
}

Expand Down Expand Up @@ -132,6 +144,7 @@ func TestFeatureCollectionFromItems(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
result, err := FeatureCollectionFromItems(tt.inputVer, tt.inputSchema)
assert.Equal(t, tt.expected, result, "FeatureCollectionFromItems() expected %v but got %v", tt.expected, result)
if tt.expectError {
Expand Down
1 change: 1 addition & 0 deletions server/pkg/integrationapi/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func Test_NewProject(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
result := NewProject(tt.p)
assert.Equal(t, tt.want, result)
})
Expand Down

0 comments on commit e86d83e

Please sign in to comment.