adding different testfiles

This commit is contained in:
Martin Karkowski 2020-08-23 09:28:03 +02:00
parent bf6a2883e5
commit f554a10246
6 changed files with 69 additions and 9 deletions

16
test/testAnalyzer.ts Normal file
View File

@ -0,0 +1,16 @@
import { Project } from "ts-morph";
import { analyzeClasses, createFileMapping } from "../lib/helpers/analyzeTypescriptFiles";
import { transformClass } from "../lib/helpers/generateTemplate";
// Function to Determine new project files.
const project = new Project({
tsConfigFilePath: "./tsconfigBackend.json",
addFilesFromTsConfig: false,
});
project.addSourceFileAtPath("./test/testFile.ts");
project.addSourceFileAtPath("./test/testExternalDescriptor.ts");
project.addSourceFileAtPath("./test/testExternalDescriptorReference.ts");
const testSourceFiles = project.getSourceFiles();
transformClass(testSourceFiles)
console.log('');

View File

@ -1,6 +1,6 @@
import { eportApi, exportMethod, exportProperty } from "../lib/decorators"; import { exportsElementsToDispatcher, exportMethodToDispatcher, exportPropertyToDispatcher } from "../lib/dispatcher/nopeDispatcherDecorators";
@eportApi({ @exportsElementsToDispatcher({
url: 'icemaker' url: 'icemaker'
}) })
export class Icemaker { export class Icemaker {
@ -8,17 +8,17 @@ export class Icemaker {
toppings = []; toppings = [];
sugar = 0; sugar = 0;
@exportMethod() @exportMethodToDispatcher()
addTopping(topping) { addTopping(topping) {
this.toppings.push(topping); this.toppings.push(topping);
} }
@exportMethod() @exportMethodToDispatcher()
addSugar() { addSugar() {
this.sugar++; this.sugar++;
} }
@exportProperty() @exportPropertyToDispatcher()
name: string; name: string;
} }

View File

@ -1,12 +1,11 @@
import { CallDispatcher } from "../lib/callDispatcher"; import { nopeDispatcher } from "../lib/dispatcher/nopeDispatcher";
import { EventLayer } from "../lib/communication/eventLayer"; import { EventLayer } from "../lib/communication/eventLayer";
const communicationLayer = new EventLayer(); const communicationLayer = new EventLayer();
const local = new CallDispatcher(communicationLayer); const local = new nopeDispatcher(communicationLayer);
const remote = new CallDispatcher(communicationLayer); const remote = new nopeDispatcher(communicationLayer);
const _functionRemote = async (a: number, b: number, operation: (a: number, b: number) => number) => { const _functionRemote = async (a: number, b: number, operation: (a: number, b: number) => number) => {
return await operation(a, b); return await operation(a, b);
} }

View File

@ -0,0 +1,10 @@
import { IF02 } from "./testExternalDescriptorReference";
export interface IF01 {
name: string,
arrays: {
// Hat hier auch noch ein Tolles Kommentar
if02: IF02[],
num: number[]
}
}

View File

@ -0,0 +1,4 @@
export interface IF02 {
name: string,
num: number,
}

31
test/testFile.ts Normal file
View File

@ -0,0 +1,31 @@
import { nopeObservable } from "../lib/observables/nopeObservable";
import { exportsElementsToDispatcher, exportMethodToDispatcher, exportPropertyToDispatcher } from "../lib/dispatcher/nopeDispatcherDecorators";
import { IF01 } from "./testExternalDescriptor";
import { IF02 } from "./testExternalDescriptorReference";
exportsElementsToDispatcher('test-api')
export class CLWithInterface {
@exportPropertyToDispatcher
exportedAttributeSimple = new nopeObservable<boolean>(false);
@exportPropertyToDispatcher
exportedAttributeComplex = new nopeObservable<{
element01: IF02,
num: number
}>({
element01: {
name: '',
num: 0
},
num: 0
});
@exportMethodToDispatcher()
async exportedFunction(a: number, b: number, operator: (a: number,b: number) => Promise<number>){
return await operator(a,b);
}
exportedFunctionWithError(a: number, b: number, operator: (a: number,b: number) => Promise<number>){
return operator(a,b);
}
}