Skip to content

Commit 853afd9

Browse files
author
Benjamin Lichtman
committed
Add test
1 parent 2c881fd commit 853afd9

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
@@ -1132,6 +1132,12 @@ function [#|f|]() {
11321132
const [#|foo|] = function () {
11331133
return fetch('https://typescriptlang.org').then(result => { console.log(result) });
11341134
}
1135+
`);
1136+
1137+
_testConvertToAsyncFunction("convertToAsyncFunction_simpleFunctionExpressionWithName", `
1138+
const foo = function [#|f|]() {
1139+
return fetch('https://typescriptlang.org').then(result => { console.log(result) });
1140+
}
11351141
`);
11361142

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

0 commit comments

Comments
 (0)