You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Applications often want to write tests that assert against something in a component, in test mode a component will render a test version, containing the arguments passed to it as JSON (not fetching anything from static).
Currently apps tend to do a substring match on the JSON within the component wrapper, which is a bit hacky. Ideally there would be test helpers that can assert a specific argument was passed to the component, without having to parse the JSON out of the markup in each application.
eg,
assert_component('title', 'context', 'foo')
This requires writing helpers for a set of testing frameworks, but as we standardised our rails frontends that should be easier, and at the least we could add a helper for the most common one.
Applications often want to write tests that assert against something in a component, in test mode a component will render a test version, containing the arguments passed to it as JSON (not fetching anything from static).
Currently apps tend to do a substring match on the JSON within the component wrapper, which is a bit hacky. Ideally there would be test helpers that can assert a specific argument was passed to the component, without having to parse the JSON out of the markup in each application.
eg,
This requires writing helpers for a set of testing frameworks, but as we standardised our rails frontends that should be easier, and at the least we could add a helper for the most common one.
Heres an example for an application implementing these helpers itself: https://github.com/alphagov/government-frontend/blob/master/test/test_helper.rb#L24-L83
It would be nice if this was re-usable in other apps.
The text was updated successfully, but these errors were encountered: