Repository navigation
Conversation
- Expand errorMessage coverage (non-string API message, missing fields). - Elements AddElementForm / EditElementForm: required validation, submit, cancel, reset. - TemplateTree AddElementForm: loads library, type switch (element vs HTML), placeholder fields, submit payload. - notifyError shows title + errorMessage description.
|
The
The two reset tests check the field before the reset has reached the input; wrapping the assertion in Please fix these before merge. |
The reset tests asserted against a stale input node after Ant Design remounted the field. Re-query the title inside waitFor. TemplateTree's Type option query also matched the Element field label, and submitting without a type shows two required messages (Type and Element). Co-authored-by: petroved <arthur.tkachenko.netweight@gmail.com>
vadim9999
left a comment
There was a problem hiding this comment.
The new tests are solid and all CI checks pass, but the PR closes #57 without the threshold ratchet that issue asks for.
Blocking
-
vitest.config.mts:20(not in the diff): coverage thresholds are not raised. WithCloses #57, merging closes the issue, but its third acceptance criterion is unmet ("coverage.thresholdsraised to the measured values rounded down to a whole number"). The testing skill says the same: "When it goes up noticeably, raise the thresholds in the same PR." Coverage from this PR'stestrun compared withmaster(e858879):Metric master this PR threshold now should be Lines 86.04 86.76 85 86 Statements 84.19 85.20 83 85 Functions 79.69 82.33 79 82 Branches 76.84 77.63 75 77 Without the bump, the gain isn't locked in: a later PR can drop functions back to 79.x and CI stays green, which is the problem #57 describes. Fix: set
thresholds: { lines: 86, statements: 85, functions: 82, branches: 77 }. Or changeCloses #57toPart of #57and raise them in a follow-up.
Suggestions
src/editor/Main/notifyError.test.ts:6-8: the spy's call history carries over between tests (see inline).
Also checked, no issues: @/api/main is mocked in the TemplateTree form test; there are no network calls; assertions target labels, roles and visible text, apart from the documented ant-select-item-option workaround; the act(...) warning in the CI log comes from the existing TemplateTree.test.tsx, not from these files. CI: build, docker, test and playwright all pass.
What
More unit tests on the API side and the React/Antd form side.
src/api/errors.test.ts): extra cases forerrorMessage— non-string backend message, missingerror.message, null/undefined.AddElementForm.test.tsx— submit, required validation, cancel, reset.EditElementForm.test.tsx— initial values, submit keeps the key, required, reset, cancel.AddElementForm.test.tsx— loads the element library, switches between Element and HTML, shows placeholder fields, submits the correct payload.notifyError.test.ts— shows title +errorMessagedescription (backend message and plain Error).Why
Closes #57
The main flows (Elements list, TemplateTree context menu) were already covered. The form components themselves and the shared error helper had little or no direct coverage.
How to verify
npm test(ornpm run test:coverage). All new tests pass; existing tests unchanged.Checklist
npm run lint,npm run typecheck,npm run format:check(new files follow existing style)npm run test:coverage— new behavior covered