Skip to content

Commit

Permalink
tests: fix broken test (#416)
Browse files Browse the repository at this point in the history
  • Loading branch information
juanjoDiaz authored and knownasilya committed Aug 27, 2019
1 parent d6c1c5f commit e0baab8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion test/CLI.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ module.exports = (testRunner, jsonFixtures, csvFixtures) => {
});

testRunner.add('field.value function should receive a valid field object', (t) => {
const opts = ' --fields-config ' + getFixturePath('/fields/functionWithCheck.js');
const opts = ' --config ' + getFixturePath('/fields/functionWithCheck.js');

child_process.exec(cli + '-i ' + getFixturePath('/json/functionStringifyByDefault.json') + opts, (err, stdout, stderr) => {
t.notOk(stderr);
Expand Down
18 changes: 10 additions & 8 deletions test/fixtures/fields/functionWithCheck.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
module.exports = [{
label: 'Value1',
value: (row, field) => {
if(field.label !== 'Value1' && field.default !== 'default value') {
throw new Error(`Expected ${JSON.stringify(field)} to equals ${JSON.stringify({ label: 'Value1', default: 'default value' })}.`);
module.exports = {
fields: [{
label: 'Value1',
value: (row, field) => {
if(field.label !== 'Value1' && field.default !== 'default value') {
throw new Error(`Expected ${JSON.stringify(field)} to equals ${JSON.stringify({ label: 'Value1', default: 'default value' })}.`);
}
return row.value1.toLocaleString();
}
return row.value1.toLocaleString();
}
}];
}]
};

0 comments on commit e0baab8

Please sign in to comment.