@@ -17,6 +17,8 @@ import path from 'path';
1717
1818const schema = 'simple_model.graphql' ;
1919
20+ const skip = new Set ( [ 'v2-cyclic-has-one-dependency' , 'v2-cyclic-has-many-dependency' ] ) ;
21+
2022describe ( 'build app - JS' , ( ) => {
2123 let apiName : string ;
2224 const projectRoot = path . resolve ( 'test-apps/ts' ) ;
@@ -39,16 +41,40 @@ describe('build app - JS', () => {
3941 } ) ;
4042
4143 Object . entries ( schemas ) . forEach ( ( [ schemaName , schema ] ) => {
42- // @ts -ignore
43- it ( `builds with ${ schemaName } : ${ schema . description } ` , async ( ) => {
44- // @ts -ignore
45- const schemaText = `input AMPLIFY { globalAuthRule: AuthRule = { allow: public } }\n${ schema . sdl } ` ;
44+ const testName = `builds with ${ schemaName } : ${ ( schema as any ) . description } ` ;
45+ const testFunction = async ( ) => {
46+ const schemaText = `input AMPLIFY { globalAuthRule: AuthRule = { allow: public } }\n${ ( schema as any ) . sdl } ` ;
4647 updateApiSchemaWithText ( projectRoot , apiName , schemaText ) ;
4748 apiGqlCompile ( projectRoot ) ;
4849 await generateModels ( projectRoot ) ;
4950 await generateStatementsAndTypes ( projectRoot ) ;
5051 await craBuild ( projectRoot , { ...config } ) ;
51- } ) ;
52+ } ;
53+ if ( skip . has ( schemaName ) ) {
54+ it . skip ( testName , testFunction ) ;
55+ } else {
56+ it ( testName , testFunction ) ;
57+ }
58+ } ) ;
59+
60+ [
61+ [ 'v2-cyclic-has-one-dependency' , schemas [ 'v2-cyclic-has-one-dependency' ] ] ,
62+ [ 'v2-cyclic-has-many-dependency' , schemas [ 'v2-cyclic-has-many-dependency' ] ] ,
63+ ] . forEach ( ( [ schemaName , schema ] ) => {
64+ // @ts -ignore
65+ const testName = `builds with ${ schemaName } : ${ schema . description } ` ;
66+ const testFunction = async ( ) => {
67+ const schemaText = `input AMPLIFY { globalAuthRule: AuthRule = { allow: public } }\n${ ( schema as any ) . sdl } ` ;
68+ updateApiSchemaWithText ( projectRoot , apiName , schemaText ) ;
69+ apiGqlCompile ( projectRoot ) ;
70+ await generateModels ( projectRoot ) ;
71+ await craBuild ( projectRoot , { ...config } ) ;
72+ } ;
73+ if ( skip . has ( schemaName ) ) {
74+ it . skip ( testName , testFunction ) ;
75+ } else {
76+ it ( testName , testFunction ) ;
77+ }
5278 } ) ;
5379
5480 it ( 'fails build with syntax error in models' , async ( ) => {
0 commit comments