/* tslint:disable */ // todo: redo tests //import * as assert from "assert"; //import {getInfoFromString} from "./../../../main"; //const code = `/** // * Some class description // */ //@ClassDecorator //@ClassDecorator2(1, 2, "3") //abstract class MyClass { // /** // * Some static property description // */ // @StaticPropertyDecorator // @StaticPropertyDecorator2() // static readonly myStaticString: string; // /** // * Some static method description // */ // @StaticMethodDecorator // @StaticMethodDecorator2() // static myStaticMethod() { // } // static async myAsyncStaticMethod() { // } // protected myString: string; // private myPrivateString: string; // /** // * Some property description // */ // @PropertyDecorator // @PropertyDecorator2() // nonOptionalString = "text"; // optionalNumber?: number; // protected abstract readonly myAbstractReadonlyProperty: string; // protected abstract get myAbstractAccessorProperty(): string; // protected abstract set myAbstractAccessorProperty(value: string); // get myGet(): string { // return ""; // } // set mySet(value: string) { // } // get myGetSet(): string { // return ""; // } // set myGetSet(value: string) { // } // private get myGetWithWriteDefined(): string { // return ""; // } // private set mySetWithWriteDefined(value: string) { // } // protected get myGetSetWithWriteDefined(): string { // return ""; // } // protected set myGetSetWithWriteDefined(value: string) { // } // /** // * Some constructure description // */ // constructor(@ParameterDecorator @ParameterDecorator2("text") myParam: string, public readonly myPublicParam: any, protected myProtectedParam: any, private myPrivateParam: any) { // } // abstract myAbstractMethod(): string; // abstract myAbstractMethod2(): string; // abstract myAbstractMethod2(str?: string): string; // /** // * Some method description // */ // @MethodDecorator // @MethodDecorator2() // myMethod() { // } // myParamTypeGuard(@ParameterDecorator @ParameterDecorator2() p: string | MyClass): p is MyClass { // } // myThisTypeGuard(): this is MyClass { // } // private myMethodWithOverloadSignatures(): string; // private myMethodWithOverloadSignatures(str?: string) { // return ""; // } // private myPrivateMethod() { // } // private *myGeneratorMethod() { // } // async myAsyncMethod() { // } // abstract async myAbstractAsyncMethod(); //} //class MyClassWithPrivateConstructor { // private constructor() { // } //} //class MyTypeParameterClass { //} //class MyChildClass extends MyTypeParameterClass { //} //class MyImplementsClass implements MyChildClass { //} //class MyExtendsImplementsClass extends MyChildClass implements MyImplementsClass { //} //class MyExtendsArray extends Array { //} //class MyClassWithOverloadSignatures { // constructor(param: number); // constructor(param: string); // constructor(param: any) { // } //} //`; //describe("ClassDefinition", () => { // const file = getInfoFromString(code); // describe("write()", () => { // describe("MyClass", () => { // it("should contain the class written out", () => { // const expected = //`/** // * Some class description // */ //@ClassDecorator //@ClassDecorator2(1, 2, "3") //abstract class MyClass { // /** // * Some static property description // */ // @StaticPropertyDecorator // @StaticPropertyDecorator2() // static readonly myStaticString: string; // /** // * Some static method description // */ // @StaticMethodDecorator // @StaticMethodDecorator2() // static myStaticMethod() { // } // static async myAsyncStaticMethod() { // } // protected myString: string; // private myPrivateString: string; // /** // * Some property description // */ // @PropertyDecorator // @PropertyDecorator2() // nonOptionalString = "text"; // optionalNumber?: number; // protected abstract readonly myAbstractReadonlyProperty: string; // protected abstract get myAbstractAccessorProperty(): string; // protected abstract set myAbstractAccessorProperty(value: string); // myGet: string; // mySet: string; // myGetSet: string; // private get myGetWithWriteDefined(): string { // return ""; // } // private set mySetWithWriteDefined(value: string) { // alert(value); // } // protected get myGetSetWithWriteDefined(): string { // return ""; // } // protected set myGetSetWithWriteDefined(value: string) { // alert(value); // } // /** // * Some constructure description // */ // constructor(@ParameterDecorator @ParameterDecorator2("text") myParam: string, public readonly myPublicParam: any, protected myProtectedParam: any, private myPrivateParam: any) { // } // abstract myAbstractMethod(): string; // abstract myAbstractMethod2(): string; // abstract myAbstractMethod2(str?: string): string; // /** // * Some method description // */ // @MethodDecorator // @MethodDecorator2() // myMethod() { // } // myParamTypeGuard(@ParameterDecorator @ParameterDecorator2() p: string | MyClass): p is MyClass { // } // myThisTypeGuard(): this is MyClass { // } // private myMethodWithOverloadSignatures(): string; // private myMethodWithOverloadSignatures(str?: string): string { // } // private myPrivateMethod() { // } // private *myGeneratorMethod() { // } // async myAsyncMethod() { // } // abstract async myAbstractAsyncMethod(): any; //} //`; // const classDef = file.classes[0]; // const getSetProperty = classDef.getProperty("myGetSetWithWriteDefined")!; // getSetProperty.onWriteGetBody = writer => writer.write(`return "";`); // getSetProperty.onWriteSetBody = writer => writer.write(`alert(value);`); // classDef.getProperty("myGetWithWriteDefined")!.onWriteGetBody = writer => writer.write(`return "";`); // classDef.getProperty("mySetWithWriteDefined")!.onWriteSetBody = writer => writer.write(`alert(value);`); // assert.equal(classDef.write(), expected); // }); // }); // describe("MyClassWithPrivateConstructor", () => { // it("should contain the class written out", () => { // const expected = //`class MyClassWithPrivateConstructor { // private constructor() { // } //} //`; // assert.equal(file.classes[1].write(), expected); // }); // }); // describe("MyTypeParameterClass", () => { // it("should contain the class written out", () => { // const expected = //`class MyTypeParameterClass { //} //`; // assert.equal(file.classes[2].write(), expected); // }); // }); // describe("MyChildClass", () => { // it("should contain the class written out", () => { // const expected = //`class MyChildClass extends MyTypeParameterClass { //} //`; // assert.equal(file.classes[3].write(), expected); // }); // }); // describe("MyImplementsClass", () => { // it("should contain the class written out", () => { // const expected = //`class MyImplementsClass implements MyChildClass { //} //`; // assert.equal(file.classes[4].write(), expected); // }); // }); // describe("MyExtendsImplementsClass", () => { // it("should contain the class written out", () => { // const expected = //`class MyExtendsImplementsClass extends MyChildClass implements MyImplementsClass { //} //`; // assert.equal(file.classes[5].write(), expected); // }); // }); // describe("MyExtendsArray", () => { // it("should contain the class written out", () => { // const expected = //`class MyExtendsArray extends Array { //} //`; // assert.equal(file.classes[6].write(), expected); // }); // }); // describe("MyClassWithOverloadSignatures", () => { // it("should contain the class written out", () => { // const expected = //`class MyClassWithOverloadSignatures { // constructor(param: number); // constructor(param: string); // constructor(param: any) { // } //} //`; // assert.equal(file.classes[7].write(), expected); // }); // }); // }); //});