mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-18 16:01:40 +03:00
4d8c2ebb1f
refs https://github.com/TryGhost/Team/issues/765 Support for multiple products means we can no longer map a members state to a csv row using just the `complimentary_plan` option. Instead we must include the product(s) that a member has. This ensures that we can read and write this data from/to csv files.
20 lines
671 B
JavaScript
20 lines
671 B
JavaScript
const should = require('should');
|
|
const unparse = require('../lib/unparse');
|
|
|
|
describe('unparse', function () {
|
|
it('serializes json to CSV and adds standard members fields', async function () {
|
|
const json = [{
|
|
email: 'email@example.com',
|
|
name: 'Sam Memberino',
|
|
note: 'Early supporter'
|
|
}];
|
|
|
|
const result = unparse(json);
|
|
|
|
should.exist(result);
|
|
|
|
const expected = `id,email,name,note,subscribed_to_emails,complimentary_plan,stripe_customer_id,created_at,deleted_at,labels,products\r\n,email@example.com,Sam Memberino,Early supporter,,,,,,,`;
|
|
should.equal(result, expected);
|
|
});
|
|
});
|