Skip to content

[IMP] tests: add test guidelines#8168

Open
hokolomopo wants to merge 1 commit intomasterfrom
master-test-guidelines-adrm
Open

[IMP] tests: add test guidelines#8168
hokolomopo wants to merge 1 commit intomasterfrom
master-test-guidelines-adrm

Conversation

@hokolomopo
Copy link
Copy Markdown
Contributor

Description

Task: 0

review checklist

  • feature is organized in plugin, or UI components
  • support of duplicate sheet (deep copy)
  • in model/core: ranges are Range object, and can be adapted (adaptRanges)
  • in model/UI: ranges are strings (to show the user)
  • undo-able commands (uses this.history.update)
  • multiuser-able commands (has inverse commands and transformations where needed)
  • new/updated/removed commands are documented
  • exportable in excel
  • translations (_t("qmsdf %s", abc))
  • unit tested
  • clean commented code
  • track breaking changes
  • doc is rebuild (npm run doc)
  • status is correct in Odoo

@robodoo
Copy link
Copy Markdown
Collaborator

robodoo commented Mar 24, 2026

Pull request status dashboard

@hokolomopo hokolomopo force-pushed the master-test-guidelines-adrm branch from 16071e5 to 6975752 Compare March 24, 2026 08:43
Copy link
Copy Markdown
Collaborator

@LucasLefevre LucasLefevre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few other things are worth mentioning IMO:

  • tests should be minimal
  • tests should not be coupled to implementation details


### Use helpers rather than manual command dispatch

Rather than calling `model.dispatch("UPDATE_CELL", {...})` use the helpers functions inside `commands_helpers.ts`. And if there are no helper for the command you need to dispatch, create one ! It's easier to read in the test, and in the future if (when) the command is changed, only this helper will need to be modified.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Rather than calling `model.dispatch("UPDATE_CELL", {...})` use the helpers functions inside `commands_helpers.ts`. And if there are no helper for the command you need to dispatch, create one ! It's easier to read in the test, and in the future if (when) the command is changed, only this helper will need to be modified.
Rather than calling `model.dispatch("UPDATE_CELL", {...})` use the helpers functions inside `commands_helpers.ts`. And if there are no helper for the command you need to dispatch, create one ! It's easier to read in the test. It also decouples the test from the implementation: in the future if (when) the command changes, only this helper needs to be modified.


### Use custom Jest matchers

We define custom jest matchers in `jest_extend.ts`, use them !
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

standard English typography do not have a space there

Suggested change
We define custom jest matchers in `jest_extend.ts`, use them !
We define custom jest matchers in `jest_extend.ts`, use them!

@hokolomopo hokolomopo force-pushed the master-test-guidelines-adrm branch from 6975752 to 24ca163 Compare March 24, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants