From 37390e714d0919f852cf4ac3516cefd56c6c8c04 Mon Sep 17 00:00:00 2001 From: Vandy Liu Date: Sun, 14 Apr 2024 23:45:56 -0700 Subject: [PATCH] fix tests --- internal/provider/validators/is_cuid_test.go | 5 +++-- internal/utils/list_test.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/provider/validators/is_cuid_test.go b/internal/provider/validators/is_cuid_test.go index aa0335f8..5916d93e 100644 --- a/internal/provider/validators/is_cuid_test.go +++ b/internal/provider/validators/is_cuid_test.go @@ -1,6 +1,7 @@ package validators_test import ( + "fmt" "testing" "github.com/astronomer/astronomer-terraform-provider/internal/provider/validators" @@ -16,7 +17,7 @@ func TestUnit_Validators_IsCuid(t *testing.T) { expectedIsCuid bool } testCases := []testCase{ - {str: "null", expectedIsCuid: false}, + {str: "null", expectedIsCuid: true}, {str: "unknown", expectedIsCuid: true}, {str: cuid.New(), expectedIsCuid: true}, {str: "abcdef", expectedIsCuid: false}, @@ -39,7 +40,7 @@ func TestUnit_Validators_IsCuid(t *testing.T) { } response := validator.StringResponse{} isCuidValidator.ValidateString(nil, request, &response) - assert.Equal(t, response.Diagnostics.HasError(), !tc.expectedIsCuid) + assert.Equal(t, response.Diagnostics.HasError(), !tc.expectedIsCuid, fmt.Sprintf("test case: %s failed", tc.str)) }) } } diff --git a/internal/utils/list_test.go b/internal/utils/list_test.go index f063eae6..abbc7e48 100644 --- a/internal/utils/list_test.go +++ b/internal/utils/list_test.go @@ -83,7 +83,7 @@ func TestUnit_ObjectList(t *testing.T) { assert.Contains(t, objString, v.Key.ValueString()) assert.Contains(t, objString, v.Value.ValueString()) assert.Contains(t, objString, v.UpdatedAt.ValueString()) - assert.Contains(t, objString, v.IsSecret.ValueBool()) + assert.Contains(t, objString, fmt.Sprintf("%v", v.IsSecret.ValueBool())) } }) }