Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpectCommandToSupportJSONFields ¶
func ExpectCommandToSupportJSONFields[T any](t *testing.T, fn NewCmdFunc[T], expectedFields []string)
ExpectCommandToSupportJSONFields asserts that the provided command supports exactly the provided fields. Ordering of the expected fields is not important.
Make sure you are not pointing to the same slice of fields in the test and the implementation. It can be a little tedious to rewrite the fields inline in the test but it's significantly more useful because:
- It forces the test author to think about and convey exactly the expected fields for a command
- It avoids accidentally adding fields to a command, and the test passing unintentionally
Types ¶
type NewCmdFunc ¶
NewCmdFunc represents the typical function signature we use for creating commands e.g. `NewCmdView`.
It is generic over `T` as each command construction has their own Options type e.g. `ViewOptions`
Click to show internal directories.
Click to hide internal directories.