mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Updated fixture utils for Products & Prices
no-issue This ensures that the fixture Product is added, and the Prices are linked to it.
This commit is contained in:
parent
569f1c559d
commit
e1f0eb8794
1 changed files with 5 additions and 3 deletions
|
@ -477,11 +477,13 @@ const fixtures = {
|
||||||
return models.MemberStripeCustomer.add(customer, context.internal);
|
return models.MemberStripeCustomer.add(customer, context.internal);
|
||||||
});
|
});
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
return Promise.each(_.cloneDeep(DataGenerator.forKnex.products), function (product) {
|
let productsToInsert = fixtureUtils.findModelFixtures('Product').entries;
|
||||||
return models.Product.add(product, context.internal);
|
return Promise.map(productsToInsert, product => models.Product.add(product, context.internal));
|
||||||
});
|
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
|
return models.Product.findOne({}, context.internal);
|
||||||
|
}).then(function (product) {
|
||||||
return Promise.each(_.cloneDeep(DataGenerator.forKnex.stripe_products), function (stripeProduct) {
|
return Promise.each(_.cloneDeep(DataGenerator.forKnex.stripe_products), function (stripeProduct) {
|
||||||
|
stripeProduct.product_id = product.id;
|
||||||
return models.StripeProduct.add(stripeProduct, context.internal);
|
return models.StripeProduct.add(stripeProduct, context.internal);
|
||||||
});
|
});
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
|
|
Loading…
Add table
Reference in a new issue