@@ -154,7 +154,8 @@ describe('API generation', () => {
154154 describe ( 'Api list config file with options' , ( ) => {
155155 const modelFile = path . join ( dest , 'raml1.json' ) ;
156156 const compactModelFile = path . join ( dest , 'raml1-compact.json' ) ;
157- const flattenedModelFile = path . join ( dest , 'flattenedApi-compact.json' ) ;
157+ const flattenedModelFile = path . join ( dest , 'flattenedApi.json' ) ;
158+ const compactFlattenedModelFile = path . join ( dest , 'flattenedApi-compact.json' ) ;
158159 const configFile = path . join ( 'test' , 'apis-options.json' ) ;
159160
160161 afterEach ( ( ) => fs . remove ( dest ) ) ;
@@ -167,22 +168,34 @@ describe('API generation', () => {
167168 assert . typeOf ( data , 'array' ) ;
168169 } ) ) ;
169170
170- it ( 'Generates data model for compact model' , ( ) => generator ( configFile )
171+ it ( 'Generates flattened data model for compact model' , ( ) => generator ( configFile )
172+ . then ( ( ) => fs . pathExists ( compactModelFile ) )
173+ . then ( ( exists ) => assert . isTrue ( exists ) )
174+ . then ( ( ) => fs . readJson ( compactModelFile ) )
175+ . then ( ( data ) => {
176+ assert . typeOf ( data , 'array' ) ;
177+ } ) ) ;
178+
179+ it ( 'Generates flattened data model for regular model' , ( ) => generator ( configFile )
171180 . then ( ( ) => fs . pathExists ( flattenedModelFile ) )
172181 . then ( ( exists ) => assert . isTrue ( exists ) )
173182 . then ( ( ) => fs . readJson ( flattenedModelFile ) )
174183 . then ( ( data ) => {
175184 const graph = data [ '@graph' ] ;
176185 assert . isDefined ( graph ) ;
186+ const ctx = data [ '@context' ] ;
187+ assert . isUndefined ( ctx ) ;
177188 } ) ) ;
178189
179-
180- it ( 'Generates flattened data model' , ( ) => generator ( configFile )
181- . then ( ( ) => fs . pathExists ( compactModelFile ) )
190+ it ( 'Generates flattened data model for compact model' , ( ) => generator ( configFile )
191+ . then ( ( ) => fs . pathExists ( compactFlattenedModelFile ) )
182192 . then ( ( exists ) => assert . isTrue ( exists ) )
183- . then ( ( ) => fs . readJson ( compactModelFile ) )
193+ . then ( ( ) => fs . readJson ( compactFlattenedModelFile ) )
184194 . then ( ( data ) => {
185- assert . typeOf ( data , 'array' ) ;
195+ const graph = data [ '@graph' ] ;
196+ assert . isDefined ( graph ) ;
197+ const ctx = data [ '@context' ] ;
198+ assert . typeOf ( ctx , 'object' ) ;
186199 } ) ) ;
187200 } ) ;
188201
0 commit comments