Skip to content

Commit 42fa60e

Browse files
committed
test(writejson) writejson, writejson.sync.try: add write error
1 parent 961d5de commit 42fa60e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/writejson.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,19 @@ test('writejson: should write json data to file with default options', t => {
8080
});
8181
});
8282

83+
test('writejson: write error', t => {
84+
writejson('/hello.json', json, error => {
85+
t.ok(error, 'should return error: ' + error.message);
86+
t.end();
87+
});
88+
});
89+
90+
test('writejson.sync.try: write error', t => {
91+
let error = writejson.sync.try('/hello.json', json)
92+
t.ok(error, 'should return error: ' + error.message);
93+
t.end();
94+
});
95+
8396
test('writejson: no args', t => {
8497
t.throws(writejson, /name should be string!/, 'NAME check');
8598
t.end();

0 commit comments

Comments
 (0)