Body Assertions (Expect API)
Validate JSON structures, arrays, and primitive payload types exactly.
Available Matchers
toBe(expected)
Asserts strict equality (===). Equivalent to primitive strict matches.
ts
toEqual(expected)
Asserts deep strict equality for full objects or complex arrays.
ts
toExist()
Asserts that the body payload is strictly not undefined or null.
ts
toBeType(type)
Validates the primitive runtime type. Arrays are explicitly mapped to "array". Supported: "string" | "number" | "boolean" | "object" | "array".
ts
toContain(item)
Checks if a substring exists in a string body, or if an item exists within an array body.
ts
toHaveProperty(keyPath)
Asserts that a deep dot-notated property exists in the JSON body.
ts
toHaveLength(len)
Validates the explicit numerical length of a JSON array response.
ts
Numerical Boundaries
Asserts that the body itself (if it is a raw number) conforms to numerical limits.
ts