Skip to content

Commit

Permalink
fix: various fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ericwenn committed Aug 15, 2021
1 parent 70008a4 commit be23fd8
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 16 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/einride/protoc-gen-go-aiptest
go 1.15

require (
github.com/google/go-cmp v0.5.5
github.com/stoewer/go-strcase v1.2.0
go.einride.tech/aip v0.49.0
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d // indirect
Expand Down
2 changes: 1 addition & 1 deletion internal/plugin/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (s *serviceGenerator) generateFixture(f *protogen.GeneratedFile) {
})

f.P("type ", s.service.GoName, " struct {")
f.P("T ", testingT)
f.P("T *", testingT)
f.P("// Server to test.")
f.P("Server ", service)
f.P()
Expand Down
11 changes: 5 additions & 6 deletions internal/plugin/testcase_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ func (r *resourceGenerator) listTestCase() testCase {
f.P("parent01 := fx.nextParent(t, false)")
f.P("parent02 := fx.nextParent(t, true)")
f.P()
} else {
}

// create 15 under each parent
Expand Down Expand Up @@ -189,10 +188,11 @@ func (r *resourceGenerator) listTestCase() testCase {
f.P("var nextPageToken string")
f.P("for {")
methodList{
resource: r.resource,
method: listMethod,
parent: "parent02",
pageSize: "1",
resource: r.resource,
method: listMethod,
parent: "parent02",
pageToken: "nextPageToken",
pageSize: "1",
}.Generate(f, "response", "err", ":=")
f.P(assertNilError, "(t, err)")
f.P(assertEqual, "(t, 1, len(response.", responseResources, "))")
Expand Down Expand Up @@ -247,7 +247,6 @@ func (r *resourceGenerator) listTestCase() testCase {
f.P(protocmpTransform, "(),")
f.P(")")
f.P("})")

}

f.P("_ = ", codesNotFound)
Expand Down
11 changes: 5 additions & 6 deletions internal/plugin/testcase_search.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ func (r *resourceGenerator) searchTestCase() testCase {
f.P("parent01 := fx.nextParent(t, false)")
f.P("parent02 := fx.nextParent(t, true)")
f.P()
} else {
}

// create 15 under each parent
Expand Down Expand Up @@ -189,10 +188,11 @@ func (r *resourceGenerator) searchTestCase() testCase {
f.P("var nextPageToken string")
f.P("for {")
methodSearch{
resource: r.resource,
method: searchMethod,
parent: "parent02",
pageSize: "1",
resource: r.resource,
method: searchMethod,
parent: "parent02",
pageToken: "nextPageToken",
pageSize: "1",
}.Generate(f, "response", "err", ":=")
f.P(assertNilError, "(t, err)")
f.P(assertEqual, "(t, 1, len(response.", responseResources, "))")
Expand Down Expand Up @@ -247,7 +247,6 @@ func (r *resourceGenerator) searchTestCase() testCase {
f.P(protocmpTransform, "(),")
f.P(")")
f.P("})")

}

f.P("_ = ", codesNotFound)
Expand Down
1 change: 1 addition & 0 deletions internal/plugin/testcase_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,5 +227,6 @@ func (r *resourceGenerator) updateTestCase() testCase {

f.P("_ = ", codesNotFound)
f.P("_ = ", protocmpTransform)
f.P("_ = ", protoClone)
})
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit be23fd8

Please sign in to comment.