2020-07-08 10:40:48 +03:00
|
|
|
const should = require('should');
|
|
|
|
const unparse = require('../lib/unparse');
|
|
|
|
|
|
|
|
describe('unparse', function () {
|
|
|
|
it('serializes json to CSV and adds standard members fields', async function () {
|
2020-07-08 11:08:00 +03:00
|
|
|
const json = [{
|
|
|
|
email: 'email@example.com',
|
|
|
|
name: 'Sam Memberino',
|
|
|
|
note: 'Early supporter'
|
|
|
|
}];
|
2020-07-08 10:40:48 +03:00
|
|
|
|
|
|
|
const result = unparse(json);
|
|
|
|
|
|
|
|
should.exist(result);
|
|
|
|
|
2021-06-22 20:10:22 +03:00
|
|
|
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,,,,,,,`;
|
2020-07-08 10:40:48 +03:00
|
|
|
should.equal(result, expected);
|
|
|
|
});
|
|
|
|
});
|