Skip to content

Commit 32cb9ec

Browse files
author
Benjamin Lichtman
committed
Add test
1 parent 9e1a05c commit 32cb9ec

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

src/testRunner/unittests/convertToAsyncFunction.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,6 +1138,12 @@ const [#|foo|] = function () {
11381138
const foo = function [#|f|]() {
11391139
return fetch('https://typescriptlang.org').then(result => { console.log(result) });
11401140
}
1141+
`);
1142+
1143+
_testConvertToAsyncFunction("convertToAsyncFunction_simpleFunctionExpressionAssignedToBindingPattern", `
1144+
const { length } = [#|function|] () {
1145+
return fetch('https://typescriptlang.org').then(result => { console.log(result) });
1146+
}
11411147
`);
11421148

11431149
_testConvertToAsyncFunction("convertToAsyncFunction_catchBlockUniqueParams", `
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// ==ORIGINAL==
2+
3+
const { length } = /*[#|*/function/*|]*/ () {
4+
return fetch('https://typescriptlang.org').then(result => { console.log(result) });
5+
}
6+
7+
// ==ASYNC FUNCTION::Convert to async function==
8+
9+
const { length } = async function () {
10+
const result = await fetch('https://typescriptlang.org');
11+
console.log(result);
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// ==ORIGINAL==
2+
3+
const { length } = /*[#|*/function/*|]*/ () {
4+
return fetch('https://typescriptlang.org').then(result => { console.log(result) });
5+
}
6+
7+
// ==ASYNC FUNCTION::Convert to async function==
8+
9+
const { length } = async function () {
10+
const result = await fetch('https://typescriptlang.org');
11+
console.log(result);
12+
}

0 commit comments

Comments
 (0)