Skip to content
This repository has been archived by the owner on Jun 10, 2019. It is now read-only.

Commit

Permalink
(#21) - Add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-de-vries committed Feb 22, 2016
1 parent e0a16ab commit 89f3a91
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/fixtures/21-incorrect-return/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"plugins": [
["../../../src"]
]
}
10 changes: 10 additions & 0 deletions test/fixtures/21-incorrect-return/actual.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
async function handler() {
var response = await fetch('http://address');
if (!response.ok) {
return null; // 1
}
var json = await response.json(); // 2
return {
a: 3
};
}
22 changes: 22 additions & 0 deletions test/fixtures/21-incorrect-return/expected.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function handler() {
var response, json;
return Promise.resolve().then(function () {
return fetch('http://address');
}).then(function (_resp) {
response = _resp;

if (!response.ok) {
return null; // 1
} else {
return Promise.resolve().then(function () {
return response.json();
}).then(function (_resp) {
json = _resp; // 2

return {
a: 3
};
});
}
});
}

0 comments on commit 89f3a91

Please sign in to comment.