-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Suggestion
follow up issue of #4148.
Currently, the acceptance tests in repository-tests are using shared fixtures to run tests on different databases.
A model might have several relations.
But then the test cases have to contain a lots of relevant attribute to make all databases pass.
Examples
For example, a expected test result in belongsTo-inclusion test file:
const expected = [
{
...thorOrder,
isShipped: features.emptyValue,
// eslint-disable-next-line @typescript-eslint/camelcase
shipment_id: features.emptyValue,
customer: {
...thor,
parentId: features.emptyValue,
},
},
{
...odinOrder,
isShipped: features.emptyValue,
// eslint-disable-next-line @typescript-eslint/camelcase
shipment_id: features.emptyValue,
customer: {
...odin,
parentId: features.emptyValue,
},
},
];
parentId and is_shipped are redundant here.
Acceptance criteria
- Clean up the fixtures. Remove those not being used properties ( such as
is_shipped) - Should find a way that model classes were created dynamically by a factory function.
Stretch goal
- Separate the relations in each models so that we only need the necessary properties when we test a certain relation. For example, now
CustomerhasManyOrders, hasManyCustomers, belongsTo aCustomer, and hasOneAddress. These should be de-centered.