You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a model F that has a foreign_key to E that has a foreign_key to D that has a foreign_key ..........
eg:
test('it should do something', async () => {
const A = await Factory.model('App/Models/A').create();
const B = await Factory.model('App/Models/B').make();
const C = await Factory.model('App/Models/C').make();
const D = await Factory.model('App/Models/D').make();
const E = await Factory.model('App/Models/E').make();
const F = await Factory.model('App/Models/F').make();
await A.bs().save(B);
await B.cs().save(C);
await C.ds().save(D);
await D.es().save(E);
await E.fs().save(F);
});
How can i avoid the need to write 5 times .make() and .save() each of them? Something like:
test('it should do something', async () => {
// F factory created all the necessary models in order to work properly
const F = await Factory.model('App/Models/F').create();
});
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a model F that has a foreign_key to E that has a foreign_key to D that has a foreign_key ..........
eg:
How can i avoid the need to write 5 times .make() and .save() each of them? Something like:
I can't find anywhere googling and reading docs.
Beta Was this translation helpful? Give feedback.
All reactions