Documentation ¶
Overview ¶
Package golden helps manage goldenfiles.
Index ¶
- func WithDir(dir string) goldenFileOption
- func WithFileName(fn string) goldenFileOption
- func WithSanitizer(s Sanitizer) goldenFileOption
- func WithStringSanitizer(old, new string) goldenFileOption
- type GoldenFile
- func (g *GoldenFile) ApplySanitizers(s string) string
- func (g *GoldenFile) GetJSON() gjson.Result
- func (g *GoldenFile) GetName() string
- func (g *GoldenFile) GetSanitizedJSON(s gjson.Result) gjson.Result
- func (g *GoldenFile) JSONEq(a *assert.Assertions, got gjson.Result, jsonPath string)
- func (g *GoldenFile) JSONPathEqs(a *assert.Assertions, got gjson.Result, jsonPaths []string)
- type Sanitizer
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
func (*GoldenFile) JSONPathEqs ¶ added in v0.17.0
func (g *GoldenFile) JSONPathEqs(a *assert.Assertions, got gjson.Result, jsonPaths []string)
JSONPathEqs asserts that json content in jsonPaths for got and goldenfile are 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.