Vote count:
0
As far as I can see, when testing ember-data models in ember CLI, all relationships have to be listed in needs
. This is fine if the structure is simple, but in many cases there will be multiple layers.
For example, if models are set up with the following relationships defined:
Model a:
belongsTo: b
belongsTo: c
Model b:
hasMany: a
hasMany: d
Model c:
hasMany: a
belongsTo: e
Model d:
hasMany b
Model e:
hasMany c
Then every unit test for any of these models will require every other model listed in needs
, e.g. A test for c
:
needs: [
'model:a' // Because c -> a
'model:e' // Because c -> e
'model:b' // Because c -> a -> b
'model:d' // Because c -> a -> b -> d
]
My actual configuration is a lot more complication with 14 models, and each one indirectly related to all the others.
Is my understanding correct? Is there a more efficient way of doing this?
asked 2 mins ago
Ember CLI testing complicated model relationships
Aucun commentaire:
Enregistrer un commentaire