- Prefer
it/testdescriptions that state behavior:should <expected> when <condition>(or close variants), e.g.should return sorted titles when order is title. - Group related cases with
describeblocks named after the unit under test (module, function, or command behavior).
- Pure helpers and core builders in
src/core/content-type/— easiest to drive with inputs and assert outputs. src/utils/index.ts— mock Management SDK / stack boundaries.- Command classes — only when needed; they pull in
@contentstack/cli-utilities(auth, cliux) and need heavier mocks.
- No live Contentstack API calls and no real stack keys in unit tests.
- Mock
ContentstackClient(axios), Management SDK chains, orauthenticationHandleras described in jest-mocking.md.
- Do not commit
describe.only,it.only,test.only, or.skipvariants. - Run
npm testbefore pushing; usenpm run test:coveragewhen changing core logic to confirm coverage (see jest.config.js thresholds and AGENTS.md).
- Target and enforcement are documented in AGENTS.md and jest.config.js.