#140·apitable

test: add property based tests to DataBus

Author: arucilCreated Jan 5, 2023Updated Mar 3, 2026
Labelsgood first issue

I have an idea for this project.

Why?

Property based testing is a testing technique that makes sure the inherent properties of the tested object always hold. Currently there are little guarantee that objects in DataBus satisfy their inherent properties, so property based testing can be added to improve the robustness of DataBus.

What?

Add property based tests to DataBus that test the following properties:

  • After a doCommand operation,
    • the revision of a Datasheet is always increased by one.
    • the id, name, and type field of the Datasheet are not changed.
  • If a field is added to a Datasheet through the doCommand operation,
    • the number of fields in the Datasheet and all Views is always increased by one.

How?

The simple way is to conceive some example data and add them to jest tests. Even better, you can use fast-check to generate random tests.