Testing
Unit test your Masonite/Inertia application server-side !
This adapter comes with handy test assertions that you can use as you would use normal Masonite routes/views assertions.
Test Assertions
assertIsInertia()
assertInertiaComponent()
assertInertiaHasProp()
assertInertiaMissingProp()
assertInertiaPropsCount()
assertInertiaVersion()
assertInertiaRootView()
withInertia():
component()
has()
hasCount()
missing()
url()
version()
dump()
dd()
Let's use this route as an example
assertIsInertia()
Assert that the route returned an inertia response.
assertInertiaComponent()
Assert that the given component name is used.
assertInertiaHasProp(key, value=None)
Assert that the given prop is present in props. The prop value can be asserted too. Nested notations can be used.
assertInertiaMissingProp(key)
Assert that the given prop is not present in props. Nested notations can be used.
assertInertiaPropsCount(count)
Assert iterable count for a given prop.
assertInertiaVersion(version)
Assert inertia assets version is equal to given version.
assertInertiaRootView(view)
Assert inertia root view is equal to given view
withInertia()
Assert that the route returned an inertia response and return an inertia testing object to ease further testing assertions.
withInertia().dump()
Dump component name, url, props data and version of the returned response to the console.
withInertia().dd()
Same as above dump()
command but will fail and stop the test when executed.
Last updated