JS Component Unit Tests

Rules and guidelines for writing unit tests for JavaScript components in the scripts/ bridge layer

pegasystems Updated

File contents

Writing Unit-tests for JS components

  1. this.pConn should be mocked
  2. PCore should be mocked if needed
  3. please test the following methods:
  • init()
  • update(pConn)
  • updateSelf()
  • fieldOnChange(value, event)
  • fieldOnBlur(value,event)
  • onEvent(event)
  1. test interactions with this.componentManager
  2. test interactions with this.pConn
  3. test interactions with PCore (if needed)
  4. evaluate props sent in onComponentPropsUpdate() method of componentManager in one test if resonable

pegasystems/constellation-mobile-sdk commit ae076d3718

Frequently asked questions

npx get-skill add pegasystems/js-component-unit-tests