{"modulePath":"github.com/Dnote/dnote","version":"v0.6.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package testutils\n\nPackage testutils provides utilities used in tests\n\n## Functions\n\n```go\nfunc AssertDeepEqual(t *testing.T, a interface{}, b interface{}, message string)\n```\nAssertDeepEqual fails a test if the actual does not deeply equal the expected\n\n```go\nfunc AssertEqual(t *testing.T, a interface{}, b interface{}, message string)\n```\nAssertEqual errors a test if the actual does not match the expected\n\n```go\nfunc AssertEqualf(t *testing.T, a interface{}, b interface{}, message string)\n```\nAssertEqualf fails a test if the actual does not match the expected\n\n```go\nfunc AssertNotEqual(t *testing.T, a interface{}, b interface{}, message string)\n```\nAssertNotEqual fails a test if the actual matches the expected\n\n```go\nfunc CopyFixture(ctx infra.DnoteCtx, fixturePath string, filename string)\n```\nCopyFixture writes the content of the given fixture to the filename inside the dnote dir\n\n```go\nfunc InitEnv(t *testing.T, dnotehomePath string, fixturePath string, migrated bool) infra.DnoteCtx\n```\nInitEnv sets up a test env and returns a new dnote context\n\n```go\nfunc IsEqualJSON(s1, s2 []byte) (bool, error)\n```\nIsEqualJSON deeply compares two JSON byte slices\n\n```go\nfunc Login(t *testing.T, ctx *infra.DnoteCtx)\n```\nLogin simulates a logged in user by inserting credentials in the local database\n\n```go\nfunc MustExec(t *testing.T, message string, db *infra.DB, query string, args ...interface{}) sql.Result\n```\nMustExec executes the given SQL query and fails a test if an error occurs\n\n```go\nfunc MustMarshalJSON(t *testing.T, v interface{}) []byte\n```\nMustMarshalJSON marshalls the given interface into JSON. If there is any error, it fails the test.\n\n```go\nfunc MustScan(t *testing.T, message string, row *sql.Row, args ...interface{})\n```\nMustScan scans the given row and fails a test in case of any errors\n\n```go\nfunc MustUnmarshalJSON(t *testing.T, data []byte, v interface{})\n```\nMustUnmarshalJSON marshalls the given interface into JSON. If there is any error, it fails the test.\n\n```go\nfunc NewDnoteCmd(ctx infra.DnoteCtx, binaryName string, arg ...string) (*exec.Cmd, *bytes.Buffer, *bytes.Buffer, error)\n```\nNewDnoteCmd returns a new Dnote command and a pointer to stderr\n\n```go\nfunc ReadFile(ctx infra.DnoteCtx, filename string) []byte\n```\nReadFile reads the content of the file with the given name in dnote dir\n\n```go\nfunc ReadFileAbs(relpath string) []byte\n```\nReadFileAbs reads the content of the file with the given file path by resolving it as an absolute path\n\n```go\nfunc ReadJSON(path string, destination interface{})\n```\nReadJSON reads JSON fixture to the struct at the destination address\n\n```go\nfunc RunDnoteCmd(t *testing.T, ctx infra.DnoteCtx, binaryName string, arg ...string)\n```\nRunDnoteCmd runs a dnote command\n\n```go\nfunc Setup1(t *testing.T, ctx infra.DnoteCtx)\n```\nSetup1 sets up a dnote env #1 dnote4.json\n\n```go\nfunc Setup2(t *testing.T, ctx infra.DnoteCtx)\n```\nSetup2 sets up a dnote env #2 dnote3.json\n\n```go\nfunc Setup3(t *testing.T, ctx infra.DnoteCtx)\n```\nSetup3 sets up a dnote env #1 dnote1.json\n\n```go\nfunc Setup4(t *testing.T, ctx infra.DnoteCtx)\n```\nSetup4 sets up a dnote env #1 dnote2.json\n\n```go\nfunc TeardownEnv(ctx infra.DnoteCtx)\n```\nTeardownEnv cleans up the test env represented by the given context\n\n```go\nfunc UserConfirm(stdin io.WriteCloser) error\n```\nUserConfirm simulates confirmation from the user by writing to stdin\n\n```go\nfunc WaitDnoteCmd(t *testing.T, ctx infra.DnoteCtx, runFunc func(io.WriteCloser) error, binaryName string, arg ...string)\n```\nWaitDnoteCmd runs a dnote command and waits until the command is exited\n\n```go\nfunc WriteFile(ctx infra.DnoteCtx, content []byte, filename string)\n```\nWriteFile writes a file with the given content and  filename inside the dnote dir\n\n","path":"github.com/Dnote/dnote/testutils","name":"testutils","synopsis":"Package testutils provides utilities used in tests","isRedistributable":true}
