Documentation
¶
Overview ¶
Package thelper contains testing helpers.
Index ¶
- func AddFileToFs(t *testing.T, filename string, content []byte, baseFs afero.Fs)
- func AddFileToFsByName(t *testing.T, filename, subset string, baseFs afero.Fs)
- func CmpIfErr(t *testing.T, err error, old, actual, new interface{}, msg string)
- func CmpWithGoldenFile(t *testing.T, got []byte, goldenFilename, msg string)
- func IOExist(t *testing.T, Fs afero.Fs, sth string, ...) bool
- func IOReadFile(t *testing.T, Fs afero.Fs, sth string) []byte
- func MockDB(t *testing.T) (db *sqlx.DB, mock sqlmock.Sqlmock)
- func ReadJsonnet(t *testing.T, name string) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFileToFs ¶
AddFileToFs creates a file with the given filename filled with the content on the baseFs
func AddFileToFsByName ¶
AddFileToFsByName looks for the filename given over the related testdata dir and creates the file on the baseFs Notice the new file will be located in /{filename} path
func CmpIfErr ¶
CmpIfErr is the macro which'll take an error and the expected cases (old actual and new) In case of being errored, it'll cmp actual with old (to check if there are undesired changes) Else, it'll cmp actual with new (to check if the changes are correct)
func CmpWithGoldenFile ¶
CmpWithGoldenFile performs cmp over the goldenFile and the got bytes given Note: avoid testdata/%s when giving the filename
func IOExist ¶
func IOExist(t *testing.T, Fs afero.Fs, sth string, existFunc func(afero.Fs, string) (bool, error)) bool
IOExist wraps afero utility func for checking existances (.DirExists, .Exists) over the given args and handles the error given of given T
func IOReadFile ¶
IOReadFile wraps afero.ReadFile over the given args and handles the error given of given T
Types ¶
This section is empty.