0
Fork 0
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:
Fabien O'Carroll 2021-05-05 17:22:31 +01:00
parent 569f1c559d
commit e1f0eb8794

View file

@ -477,11 +477,13 @@ const fixtures = {
return models.MemberStripeCustomer.add(customer, context.internal);
});
}).then(function () {
return Promise.each(_.cloneDeep(DataGenerator.forKnex.products), function (product) {
return models.Product.add(product, context.internal);
});
let productsToInsert = fixtureUtils.findModelFixtures('Product').entries;
return Promise.map(productsToInsert, product => models.Product.add(product, context.internal));
}).then(function () {
return models.Product.findOne({}, context.internal);
}).then(function (product) {
return Promise.each(_.cloneDeep(DataGenerator.forKnex.stripe_products), function (stripeProduct) {
stripeProduct.product_id = product.id;
return models.StripeProduct.add(stripeProduct, context.internal);
});
}).then(function () {