Testing

Validate changes with project targets and manual flows. This guide follows version 3.1.7 (03acdf712c).

For the branch workflow, see Contribute to the Codebase.

Project targets

nx.json registers @nx/jest/plugin with targetName: test; Jest is ^29.7.0 with jest.preset.js. Not every project defines every target, so inspect first:

pnpm nx show project sales_ui
pnpm nx lint sales_ui
pnpm nx build sales_ui
pnpm nx test sales_ui

Use the matching _api name for backend changes. When erxes-api-shared changes, rebuild it before validating consumers:

pnpm nx build erxes-api-shared

Run affected variants (pnpm nx affected -t lint,build,test) for broader changes. Record any unavailable check and the reason; do not describe unrun checks as passed.

What to cover

  • Permissions, tenant isolation, validation, and regressions for changed behavior.
  • Content publishing edge cases: published versus draft, unknown slugs, empty portals, cursor boundaries, missing credentials.
  • Widget and portal flows: fresh session, mobile viewport, reload, navigation without credential leakage.

Examples in the repo include backend/plugins/content_api/src/modules/cms/postiz/__tests__/ (bridge, service, worker, default-permissions specs) and frontend/plugins/content_ui/src/modules/cms/hooks/__tests__/usePostMutations.test.tsx.

Source references

Was this helpful?