You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, we're making use of Gomega as a matcher library with Ginkgo, for making assertions in the tests. An example of such an assertion would be:
functestSomething() {
err:=doSomething()
gomega.Expect(err).Should(gomega.BeNil(), fmt.Sprint("failed to do something: %s", err.Error()))
}
The problem with using these directly in the tests would be that contributors now have to deal with learning the Gomega syntax for assertions, and also having too many of these look ugly and make the code less readable.
Solution
We could create reusable helper functions that essentially act as wrappers around these assertions. For example
funcExpectNil(item interface{}. annotationstring) {
gomega.Expect(err).Should(gomega.BeNil(), message)
}
functestSomething() {
err:=doSomething()
utils.ExpectNil(err, fmt.Sprintf("failed to do something: %s", err.Error()))
}
The text was updated successfully, but these errors were encountered:
Problem
Currently, we're making use of Gomega as a matcher library with Ginkgo, for making assertions in the tests. An example of such an assertion would be:
The problem with using these directly in the tests would be that contributors now have to deal with learning the Gomega syntax for assertions, and also having too many of these look ugly and make the code less readable.
Solution
We could create reusable helper functions that essentially act as wrappers around these assertions. For example
The text was updated successfully, but these errors were encountered: