Skip to content

Commit

Permalink
Code polishing 13.6.2021
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-cunderlik committed Aug 4, 2021
1 parent 330272d commit ed38faf
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
10 changes: 7 additions & 3 deletions packages/react-lowcode/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
module.exports = {
"transform": {
"^.+\\.tsx?$": "ts-jest"
"globals": {
"extensionsToTreatAsEsm": ['.ts', '.js'],
'ts-jest': {
useESM: true
}
},
"preset": 'ts-jest/presets/js-with-ts-esm',
"transformIgnorePatterns": [
"node_modules/(@iteria-app)"
'node_modules/(?!(@iteria-app)/)'
]
};
12 changes: 7 additions & 5 deletions packages/react-lowcode/src/codegen/tests/detail/detail.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ import { graphqlGenTs1 } from "../typeAlias.example"
import { UiFramework, TableType, Formatter } from '../../definition/context-types'
import { AppGenerator } from '../../generation/generators/app-generator'
import { sourceFileEntity, createAst, parseGraphqlTypes } from "../helper"
import { createEntityFromIntrospection, Entity } from "../../generation/entity"
import { is2 } from "../introspection-example"

test(".mui formik generation", () => {
const sourceFile = createAst('')
const myClassFile = parseGraphqlTypes(graphqlGenTs1)
const testEntity = sourceFileEntity(myClassFile)
const sourceFile = createAst('');
const entityName = 'customer';
const entity: Entity | undefined = createEntityFromIntrospection(is2.data.__schema, entityName);

let generationContext = {formatter: Formatter.ReactIntl, uiFramework: UiFramework.MaterialUI, tableType: TableType.BasicTable, entity: testEntity!!};
let generator = new AppGenerator(generationContext , testEntity!!);
let generationContext = {formatter: Formatter.ReactIntl, uiFramework: UiFramework.MaterialUI, tableType: TableType.BasicTable, entity: entity!!};
let generator = new AppGenerator(generationContext, entity!!);

const page = generator.generateDetailPage()

Expand Down
13 changes: 8 additions & 5 deletions packages/react-lowcode/src/codegen/tests/facade/facade.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { SourceLineCol } from "../../../ast";
import { FacadeInsertOptions } from "../../facade/interfaces";
import { TestListHelper } from "../list/list-helper";
import { is2 } from "../introspection-example"
import { Property } from "../../generation/entity";
import { createEntityFromIntrospection, Entity, Property } from "../../generation/entity";
import { TestFacadeHelper } from "./facade-helper";

describe("codegen facade tests", () => {
Expand Down Expand Up @@ -218,8 +218,11 @@ describe("codegen facade tests", () => {
});

test(".add widget to existing detail page", async () => {
const myClassFile = parseGraphqlTypes(graphqlGenTs1);
const testEntity = sourceFileEntity(myClassFile);
const entityName = 'customer';
const entityPropertyName = 'test2';

const entity: Entity | undefined = createEntityFromIntrospection(is2.data.__schema, entityName);
const property: Property | undefined = getEntityPropertyIntrospection(is2.data.__schema, entityPropertyName, entityName);

const formPosition: SourceLineCol = {
lineNumber: 33,
Expand All @@ -228,8 +231,8 @@ describe("codegen facade tests", () => {
};

const options: FacadeInsertOptions = {
entity: testEntity!!,
entityField: getEntityProperty(graphqlGenTs1,'test2')[0]
entity: entity,
entityField: property!
};

const result = await insertFormWidget(formPosition, options, new CodegenRw());
Expand Down
2 changes: 1 addition & 1 deletion packages/react-lowcode/src/codegen/tests/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function createAst(
return property ?? []
}

export function getEntityPropertyIntrospection(introspection: IntrospectionQuery, propertyName: string, typeName = "Customer"): Property | undefined {
export function getEntityPropertyIntrospection(introspection: IntrospectionQuery, propertyName: string, typeName = "customer"): Property | undefined {
const entity: Entity | undefined = createEntityFromIntrospection(introspection, typeName)

let property: Property | undefined = undefined
Expand Down

0 comments on commit ed38faf

Please sign in to comment.