Documentation
¶
Overview ¶
Package testutils provides utilities for testing SEVEN projects
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ProjectRoot is the root directory of this project ProjectRoot = filepath.Join(filepath.Dir(thisFile), "../..") // TestdataPath points to where testdata for the entirety of the SEVEN project is stored TestdataPath = path.Join(ProjectRoot, testdataFolder) // ExampleProjectsPath points to where example projects are stored ExampleProjectsPath = path.Join(ProjectRoot, testdataFolder, "example-projects") )
var ( // SandboxPath is the absolute path to the test sandbox directory SandboxPath = path.Join(ProjectRoot, testFolder, "sandbox") )
Functions ¶
func CheckErr ¶
CheckErr checks if the given error matches the expected error. If the expected error is nil, it checks that the error is nil. It returns a flag indicating whether the test should end after this check.
func CompareJSON ¶
CompareJSON parses two byte strings as JSON and compares them.
func Diff ¶
Diff compares two multi-line strings and prints a Diff similar to `git Diff`. It returns true if the strings are equal, false otherwise.
func MustReadFile ¶
MustReadFile reads the file at the given path into memory and returns its contents as a byte slice. If there is an error reading the file, it fails the test.
func UseSandbox ¶
UseSandbox will temporarily change the working directory to the sandbox for testing and cleanup and reset the working directory when the test finishes
Types ¶
This section is empty.