Skip to content

Test an Action Defined in MSON

Geoff Cox edited this page Dec 13, 2020 · 1 revision

The test-utils contains helper methods that you can use to test your actions. We recommend a test structure that:

  1. Uses compiler.newComponent() to instantiate the JS code from MSON
  2. Uses testUtils.mockAction() to mock the actions and any globals
  3. Executes the .run() method on the action
  4. Uses testUtils.expectActsToContain() to ensure that the proper actions were performed

See the should log in to app and redirect when redirectAfterLogin test for a good example.