Skip to content

Commit 76b0b2f

Browse files
author
Benjamin Lichtman
committed
Add test
1 parent a73b561 commit 76b0b2f

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

src/testRunner/unittests/convertToAsyncFunction.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,15 @@ function [#|f|](): Promise<void> {
421421
return fetch('https://typescriptlang.org').then( () => console.log("almost done") ).then( () => console.log("done") );
422422
}`
423423
);
424+
_testConvertToAsyncFunction("convertToAsyncFunction_IgnoreArgs4", `
425+
function [#|f|]() {
426+
return fetch('https://typescriptlang.org').then(res);
427+
}
428+
function res(){
429+
console.log("done");
430+
}`
431+
);
432+
424433
_testConvertToAsyncFunction("convertToAsyncFunction_Method", `
425434
class Parser {
426435
[#|f|]():Promise<void> {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// ==ORIGINAL==
2+
3+
function /*[#|*/f/*|]*/() {
4+
return fetch('https://typescriptlang.org').then(res);
5+
}
6+
function res(){
7+
console.log("done");
8+
}
9+
// ==ASYNC FUNCTION::Convert to async function==
10+
11+
async function f() {
12+
const result_1 = await fetch('https://typescriptlang.org');
13+
return res(result_1);
14+
}
15+
function res(){
16+
console.log("done");
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// ==ORIGINAL==
2+
3+
function /*[#|*/f/*|]*/() {
4+
return fetch('https://typescriptlang.org').then(res);
5+
}
6+
function res(){
7+
console.log("done");
8+
}
9+
// ==ASYNC FUNCTION::Convert to async function==
10+
11+
async function f() {
12+
const result_1 = await fetch('https://typescriptlang.org');
13+
return res(result_1);
14+
}
15+
function res(){
16+
console.log("done");
17+
}

0 commit comments

Comments
 (0)