From 2d84cfd185f515b9af009e8f921e82ecab545ca2 Mon Sep 17 00:00:00 2001 From: Dave Shanley Date: Wed, 31 Aug 2022 10:42:35 -0400 Subject: [PATCH] More channel waiting added to tests Almost there! --- datamodel/model_utils_test.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/datamodel/model_utils_test.go b/datamodel/model_utils_test.go index ac41c66..a06a31d 100644 --- a/datamodel/model_utils_test.go +++ b/datamodel/model_utils_test.go @@ -95,7 +95,9 @@ info: version: '0.1.0'` func TestExtractSpecInfo_ValidJSON(t *testing.T) { - _, e := ExtractSpecInfo([]byte(goodJSON)) + r, e := ExtractSpecInfo([]byte(goodJSON)) + <-r.JsonParsingChannel + assert.Greater(t, len(*r.SpecJSONBytes), 0) assert.Error(t, e) } @@ -110,7 +112,9 @@ func TestExtractSpecInfo_Nothing(t *testing.T) { } func TestExtractSpecInfo_ValidYAML(t *testing.T) { - _, e := ExtractSpecInfo([]byte(goodYAML)) + r, e := ExtractSpecInfo([]byte(goodYAML)) + <-r.JsonParsingChannel + assert.Greater(t, len(*r.SpecJSONBytes), 0) assert.Error(t, e) } @@ -157,6 +161,9 @@ func TestExtractSpecInfo_OpenAPI2(t *testing.T) { assert.Nil(t, e) assert.Equal(t, OpenApi2, r.SpecType) assert.Equal(t, "2.0.1", r.Version) + + <-r.JsonParsingChannel + assert.Greater(t, len(*r.SpecJSONBytes), 0) } func TestExtractSpecInfo_OpenAPI2_OddVersion(t *testing.T) { @@ -173,6 +180,8 @@ func TestExtractSpecInfo_AsyncAPI(t *testing.T) { assert.Nil(t, e) assert.Equal(t, AsyncApi, r.SpecType) assert.Equal(t, "2.0.0", r.Version) + <-r.JsonParsingChannel + assert.Greater(t, len(*r.SpecJSONBytes), 0) } func TestExtractSpecInfo_AsyncAPI_OddVersion(t *testing.T) {