Skip to content

Commit

Permalink
remove extra Convey statements in openapi_spec_analyser_test.go (causing
Browse files Browse the repository at this point in the history
 unnecessary loops)
  • Loading branch information
lillchan committed Jul 16, 2020
1 parent c22ed02 commit 5c650af
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions openapi/openapi_spec_analyser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,24 @@ func TestCreateSpecAnalyser(t *testing.T) {
openAPIDocumentURL := file.Name()
Convey("When CreateSpecAnalyser method is called", func() {
specAnalyser, err := CreateSpecAnalyser(specAnalyserVersion, openAPIDocumentURL)
Convey("Then err returned should be nil", func() {
Convey("Then the result returned should be the expected one", func() {
So(err, ShouldBeNil)
})
Convey("Then the specAnalyser is of type specV2Analyser", func() {
So(specAnalyser, ShouldHaveSameTypeAs, &specV2Analyser{})
})
})

Convey("When CreateSpecAnalyser method is called with a non valid openAPIDocumentURL", func() {
_, err := CreateSpecAnalyser(specAnalyserVersion, "some non valid spec file")
Convey("Then err returned should be nil", func() {
Convey("Then the result returned should be the expected one", func() {
So(err, ShouldNotBeNil)
})
Convey("Then the error message should equal", func() {
So(err.Error(), ShouldEqual, "failed to retrieve the OpenAPI document from 'some non valid spec file' - error = open some non valid spec file: no such file or directory")
})
})

Convey("When CreateSpecAnalyser method is called with a non supported version", func() {
_, err := CreateSpecAnalyser("nonSupportedVersion", openAPIDocumentURL)
Convey("Then err returned should be nil", func() {
Convey("Then the result returned should be the expected one", func() {
So(err, ShouldNotBeNil)
})
Convey("Then the error message should equal", func() {
So(err.Error(), ShouldEqual, "open api spec analyser version 'nonSupportedVersion' not supported, please choose a valid SpecAnalyser implementation [v2]")
})
})
Expand Down

0 comments on commit 5c650af

Please sign in to comment.