Documentation ¶
Overview ¶
Package golden helps manage goldenfiles.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithFileName ¶
func WithFileName(fn string) goldenFileOption
func WithSanitizer ¶
func WithSanitizer(s Sanitizer) goldenFileOption
func WithStringSanitizer ¶
func WithStringSanitizer(old, new string) goldenFileOption
Types ¶
type GoldenFile ¶
type GoldenFile struct {
// contains filtered or unexported fields
}
func NewOrUpdate ¶
func NewOrUpdate(t testing.TB, data string, opts ...goldenFileOption) *GoldenFile
func (*GoldenFile) ApplySanitizers ¶
func (g *GoldenFile) ApplySanitizers(s string) string
ApplySanitizers returns sanitized string
func (*GoldenFile) GetJSON ¶
func (g *GoldenFile) GetJSON() gjson.Result
GetJSON returns goldenfile as parsed json
func (*GoldenFile) GetName ¶
func (g *GoldenFile) GetName() string
GetName return path of the goldenfile
func (*GoldenFile) GetSanitizedJSON ¶
func (g *GoldenFile) GetSanitizedJSON(s gjson.Result) gjson.Result
GetSanitizedJSON returns sanitizes and returns JSON result
func (*GoldenFile) JSONEq ¶
func (g *GoldenFile) JSONEq(a *assert.Assertions, got gjson.Result, jsonPath string)
JSONEq asserts that json content in jsonPath for got and goldenfile is the same
type Sanitizer ¶
func ProjectIDSanitizer ¶
func ProjectIDSanitizer(t testing.TB) Sanitizer
ProjectIDSanitizer replaces all occurrences of current gcloud project ID with PROJECT_ID string
func StringSanitizer ¶
StringSanitizer replaces all occurrences of old string with new string
Click to show internal directories.
Click to hide internal directories.