add more tests

This commit is contained in:
Gabriela Britto
2019-02-01 16:44:22 -08:00
parent bde97d1226
commit abb11550d3
3 changed files with 49 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
/// <reference path='fourslash.ts' />
////function foo(/*a*/a: number, b: number/*b*/) {
//// return { bar: () => a + b };
////}
////var x = foo(1, 2).bar();
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Convert to named parameters",
actionName: "Convert to named parameters",
actionDescription: "Convert to named parameters",
newContent: `function foo({ a, b }: { a: number; b: number; }) {
return { bar: () => a + b };
}
var x = foo({ a: 1, b: 2 }).bar();`
});

View File

@@ -0,0 +1,25 @@
/// <reference path='fourslash.ts' />
////class A {
//// constructor(/*a*/a: string, b: string/*b*/) { }
////}
////class B extends A {
//// constructor(a: string, b: string, c: string) {
//// super(a, b);
//// }
////}
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Convert to named parameters",
actionName: "Convert to named parameters",
actionDescription: "Convert to named parameters",
newContent: `class A {
constructor({ a, b }: { a: string; b: string; }) { }
}
class B extends A {
constructor(a: string, b: string, c: string) {
super({ a: a, b: b });
}
}`
});

View File

@@ -0,0 +1,7 @@
/// <reference path='fourslash.ts' />
////const foo: (a: number, b: number) => number = /*a*/(a: number, b: number)/*b*/ => a + b;
////foo(1, 2);
goTo.select("a", "b");
verify.not.refactorAvailable("Convert to named parameters");