Improved readability of unparse test

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

- The column parameter has default behavior attached to it, so it is best to have it mentioned and used in an explicit way.
This commit is contained in:
Naz 2022-10-21 16:18:12 +08:00
parent 6c9f8ec32d
commit 6c2d057e25
No known key found for this signature in database

View File

@ -2,7 +2,7 @@ const should = require('should');
const {unparse} = require('../index'); const {unparse} = require('../index');
describe('unparse', function () { describe('unparse', function () {
it('serializes json to CSV and adds standard members fields', async function () { it('serializes json to CSV and adds standard members fields with no explicit columns parameter', async function () {
const json = [{ const json = [{
email: 'email@example.com', email: 'email@example.com',
name: 'Sam Memberino', name: 'Sam Memberino',
@ -23,7 +23,9 @@ describe('unparse', function () {
subscribed: false subscribed: false
}]; }];
const columns = Object.keys(json[0]); const columns = [
'email', 'subscribed'
];
const result = unparse(json, columns); const result = unparse(json, columns);