mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
🐛 Fixed invalid imported subscribers count (#10229)
closes #9987 - Fixed the count of invalid records when importing single column csv of subscribers
This commit is contained in:
parent
fc21b25895
commit
8b816af1c2
4 changed files with 5 additions and 11 deletions
|
@ -26,11 +26,6 @@ module.exports = function readCSV(options) {
|
|||
result[columnsToExtract[0].name] = value[headers[0]];
|
||||
return result;
|
||||
});
|
||||
|
||||
// Add first row
|
||||
result = {};
|
||||
result[columnsToExtract[0].name] = headers[0];
|
||||
results = [result].concat(results);
|
||||
} else {
|
||||
// If there are multiple columns in csv file
|
||||
// try to match headers using lookup value
|
||||
|
|
|
@ -229,7 +229,7 @@ describe('Subscribers API', function () {
|
|||
|
||||
jsonResponse.meta.stats.imported.should.equal(2);
|
||||
jsonResponse.meta.stats.duplicates.should.equal(0);
|
||||
jsonResponse.meta.stats.invalid.should.equal(1); // TODO: should return 0
|
||||
jsonResponse.meta.stats.invalid.should.equal(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -223,7 +223,7 @@ describe('Subscribers API', function () {
|
|||
|
||||
jsonResponse.meta.stats.imported.should.equal(2);
|
||||
jsonResponse.meta.stats.duplicates.should.equal(0);
|
||||
jsonResponse.meta.stats.invalid.should.equal(1); // TODO: should return 0
|
||||
jsonResponse.meta.stats.invalid.should.equal(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -10,10 +10,9 @@ describe('lib/fs: read csv', function () {
|
|||
columnsToExtract: [{name: 'email', lookup: /email/i}]
|
||||
}).then(function (result) {
|
||||
should.exist(result);
|
||||
result.length.should.eql(3);
|
||||
result[0].email.should.eql('email');
|
||||
result[1].email.should.eql('jbloggs@example.com');
|
||||
result[2].email.should.eql('test@example.com');
|
||||
result.length.should.eql(2);
|
||||
result[0].email.should.eql('jbloggs@example.com');
|
||||
result[1].email.should.eql('test@example.com');
|
||||
done();
|
||||
}).catch(done);
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue