Fixed data type of hasStripeData in member importer

refs https://github.com/TryGhost/Team/issues/1076

- What appeared to be a "boolean" by nature and name, the hasStripeData was holding a result of "find" method - and object or an undefined value
- Fixed the typing, to avoid ambiguity in the future
This commit is contained in:
Naz 2022-10-31 16:14:38 +08:00
parent ac01fc5e42
commit 4d26c50e0b
No known key found for this signature in database
2 changed files with 3 additions and 3 deletions

View File

@ -86,9 +86,9 @@ module.exports = class MembersCSVImporter {
const numberOfBatches = Math.ceil(rows.length / batchSize);
const mappedCSV = membersCSV.unparse(rows, columns);
const hasStripeData = rows.find(function rowHasStripeData(row) {
const hasStripeData = !!(rows.find(function rowHasStripeData(row) {
return !!row.stripe_customer_id || !!row.complimentary_plan;
});
}));
await fs.writeFile(outputFilePath, mappedCSV);

View File

@ -246,7 +246,7 @@ describe('Importer', function () {
result.batches.should.equal(2);
should.exist(result.metadata);
should.equal(result.metadata.hasStripeData, false);
fsWriteSpy.calledOnce.should.be.true();
});