mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Fixed tests for data generation library
no issue
This commit is contained in:
parent
9cb95140fb
commit
9b1fd0185f
2 changed files with 11 additions and 5 deletions
|
@ -9,13 +9,17 @@ class ProductsImporter extends TableImporter {
|
|||
}
|
||||
|
||||
setImportOptions() {
|
||||
this.names = ['Free Preview', 'Bronze', 'Silver', 'Gold'];
|
||||
this.names = ['Free', 'Bronze', 'Silver', 'Gold'];
|
||||
this.count = 0;
|
||||
}
|
||||
|
||||
async addStripePrices({products, stripeProducts, stripePrices}) {
|
||||
for (const {id} of products) {
|
||||
const stripeProduct = stripeProducts.find(p => id === p.product_id);
|
||||
if (!stripeProduct) {
|
||||
// Free product
|
||||
continue;
|
||||
}
|
||||
const monthlyPrice = stripePrices.find((p) => {
|
||||
return p.stripe_product_id === stripeProduct.stripe_product_id &&
|
||||
p.interval === 'monthly';
|
||||
|
|
|
@ -78,7 +78,9 @@ describe('Data Generator', function () {
|
|||
eventsOnly: false,
|
||||
knex: db,
|
||||
schema: schema,
|
||||
logger: {},
|
||||
logger: {
|
||||
info: () => {}
|
||||
},
|
||||
modelQuantities: {
|
||||
members: 10,
|
||||
membersLoginEvents: 5,
|
||||
|
@ -153,12 +155,12 @@ describe('Importer', function () {
|
|||
const products = await productsImporter.import({amount: 1, rows: ['name', 'monthly_price', 'yearly_price']});
|
||||
|
||||
products.length.should.eql(1);
|
||||
products[0].name.should.eql('Free Preview');
|
||||
products[0].name.should.eql('Free');
|
||||
|
||||
const results = await db.select('id', 'name').from('products');
|
||||
|
||||
results.length.should.eql(1);
|
||||
results[0].name.should.eql('Free Preview');
|
||||
results[0].name.should.eql('Free');
|
||||
});
|
||||
|
||||
it('Should import an item for each entry in an array', async function () {
|
||||
|
@ -201,7 +203,7 @@ describe('Importer', function () {
|
|||
const results = await db.select('id', 'name', 'monthly_price_id', 'yearly_price_id').from('products');
|
||||
|
||||
results.length.should.eql(4);
|
||||
results[0].name.should.eql('Free Preview');
|
||||
results[0].name.should.eql('Free');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue