Skip to content

Commit

Permalink
Add a test and pacify linter
Browse files Browse the repository at this point in the history
  • Loading branch information
guineveresaenger committed Apr 16, 2024
1 parent 774403a commit 679b9b5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions provider/doc_edits.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ var substituteRandomSuffix = (func() tfbridge.DocsEdit {
}
})()

// Docs discovery gets tripped up on `member/members` fields for IAM-type properties and doesn't align the content correctly.

// Docs discovery gets tripped up on `member/members` fields for IAM-type properties and doesn't align the content
// correctly.
var memberRegexp = regexp.MustCompile("`member/members`")

var rewritemembersField = tfbridge.DocsEdit{
Expand Down
20 changes: 20 additions & 0 deletions provider/doc_edits_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,23 @@ func TestBetaDescription(t *testing.T) {
})
}
}

func TestRewriteMembersField(t *testing.T) {
t.Parallel()
tests := []struct{ text, expected string }{
{
"`member/members` - Identities that will be granted privileges\n",
"`members` - Identities that will be granted privileges\n" +
"`member` - Identities that will be granted privileges\n",
},
}

for _, tt := range tests {
tt := tt
t.Run(tt.text, func(t *testing.T) {
actual, err := rewritemembersField.Edit("doc.md", []byte(tt.text))
require.NoError(t, err)
assert.Equal(t, tt.expected, string(actual))
})
}
}

0 comments on commit 679b9b5

Please sign in to comment.