Create mock CubicWeb schema for JS unit tests
When writing unit tests for JS clients, we often need to test against CubicWeb Schemas.
Individual projects usually use their own schema, but it complicates extracting features when we find those could benefit other projects as we need to rewrite all the tests.
It would be a lot easier to have a set of ready to use JS Schema with varying complexity. Those could handle different cases: empty schema, only attributes, object relations, symmetric relations, constraints...
Idea following discussion sprint
-
Move JSON and TypeScript exporters from cubicweb to yams => open-source/yams!74 (merged) -
Release yams 0.51.0 #891 (closed) -
Create a repo containing example yams schema => https://forge.extranet.logilab.fr/cubicweb/cubicweb-mock-schema -
Add a schema for basic blog -
Add a schema for most attributes and their constraints -
Add a schema for Boolean
,RichString
,Bytes
, and maybe others -
Add a schema for relations and their constraints -
In this repo, create a python script using the exporters to convert all yams schema to json/typescript. Find example schemas from existing tests (eg: https://forge.extranet.logilab.fr/cubicweb/cubes/web/-/blob/branch/default/test/data/schema.py -
Find out how to export date constraints. Will need to edit the schema exporters constraint JSON serializer. => open-source/yams!83 (merged) -
Release yams 0.52.0 -
Create a npm package using those exported json/typescript schema -
Create a PyPi package using the example schemas
Next steps