Skip to content

Automate nested context view testing #3392

@raineorshine

Description

@raineorshine

Problem

The vast majority of commands should work exactly the same within a nested context view. How to make testing both cases easier?

e.g. Consider categorizing x/y in normal view:

Before

- x
  - y

After

- x
  - [empty thought]
    - y

Categorizing a/m~/x/y should have the analogous result in a nested context view:

Before

- a
  - m
    - x
      - y
- b
  - m

After

- a
  - m
    - x
      - [empty thought]
        - y
- b
  - m

There is currently no trivial way to test both cases. Separate test cases for normal view and context view need to be manually written. Since tests for context view are often not written, this leaves a gap in test coverage. Context view functionality has a lot of minor bugs because of this.

Solution

Create a test helper function that will automatically run a test written for normal view against a nested context view.

normalAndContextView(`
  - x
    - y
`, state => {
  setCursor(...)
  categorize(...)
} `
  - x
    - [empty thought]
      - y
`)

Questions

  • How to generalize for tests with multiple assertions?
  • Should this be done at the level of reducers, action creators, or commands? Or all of the above?

Metadata

Metadata

Assignees

No one assigned

    Labels

    testTesting and project configuration

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions