Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Execute ¶
Execute a cobra command with custom args for testing using *bytes.Buffer under the hood.
Since the root cmd is used for testing, any subcommands the root command has will have to be included in the args
func GoModTidy ¶
Use this for the "get" command tests.
When running these tests locally it can affect our go.mod file, which would need to get cleaned up after every test
This is not the most clever way of handling this issue, but it's a whole FUCK of alot easier then... idk say spinning up a docker container with a dedicated go project directory just for these tests. And it suprisingly works a lot better than I thought it would
func InMemDb ¶
Spin up an in memory database (since we're using sqlite3) for quick testing
This function already includes a cleanup function where when the test completes, the database is closed
func Mock1outof3pkgs ¶
Mock the $GOPATH/pkg/mod/github.com dir using the test's TempDir
Only 1 out of 3 dirs should be "valid"
func Mock3outof3pkgs ¶
Mock the $GOPATH/pkg/mod/github.com dir using the test's TempDir
Only 3 out of 3 dirs should be "valid"
Types ¶
This section is empty.