Skip to content

Commit 3d1fb63

Browse files
committed
Add test for sync error with nfcall()
1 parent 5a3a285 commit 3d1fb63

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/promises.tests.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,19 @@ test("forEachSeries", {
165165
});
166166

167167
test("nfcall", {
168+
"when function throws error then promise is rejected": function() {
169+
return promises.nfcall(function(callback) {
170+
throw new Error("failure");
171+
}).then(
172+
function(result) {
173+
assert.fail("Expected rejection");
174+
},
175+
function(error) {
176+
assert.strictEqual(error.message, "failure");
177+
}
178+
);
179+
},
180+
168181
"when function calls callback with error then promise is rejected": function() {
169182
return promises.nfcall(function(callback) {
170183
callback(new Error("failure"));

0 commit comments

Comments
 (0)