Skip to content

Commit

Permalink
fix(tests)
Browse files Browse the repository at this point in the history
  • Loading branch information
FGRibreau committed Apr 27, 2017
1 parent ec3b9d3 commit 05c6297
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/cli.acceptance.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('worksheets', () => {
const ROW_COUNT = 150;
const COL_COUNT = 149;
return add([NAME, '--rowCount', ROW_COUNT, , '--colCount', COL_COUNT]).then(result => {
const {id, title, rowCount, colCount} = JSON.parse(result.stdout);
const {id, title, rowCount, colCount} = parse(result.stdout);
t.strictEqual(title, NAME);
t.strictEqual(rowCount, ROW_COUNT);
t.strictEqual(colCount, COL_COUNT);
Expand Down Expand Up @@ -79,7 +79,7 @@ describe('worksheets', () => {
describe('append', () => {
it('add a row into the worksheet', () => {
return list().then(res => {
const {id} = JSON.parse(res.stdout);
const {id} = parse(res.stdout);
return execa(BIN, BASE_PARAMS.concat(['worksheets', 'get', '--wsId', id, 'append', '--json', JSON5.stringify({a:1, b: 2, c:3})])).then(result => {
t.include(result.stdout, `"content":"b: 2, c: 3"`);
});
Expand All @@ -88,3 +88,14 @@ describe('worksheets', () => {
});
});
});


function parse(str){
try{
return JSON.parse(str);
} catch(err){
console.error(err);
console.error(str);
throw err;
}
}

0 comments on commit 05c6297

Please sign in to comment.