@@ -24,7 +24,7 @@ let visitor: AspectModelTypeGeneratorVisitor;
2424
2525const readFile = util . promisify ( fs . readFile ) ;
2626
27- beforeEach ( function ( ) {
27+ beforeEach ( function ( ) {
2828 visitor = new AspectModelTypeGeneratorVisitor ( {
2929 excludedProperties : [ ] ,
3030 complexProps : [ ] ,
@@ -34,19 +34,23 @@ beforeEach(function () {
3434 customRowActions : [ ] ,
3535 addCommandBar : true ,
3636 selectedModelElement : {
37- name : 'Movement' ,
37+ name : 'Movement'
3838 } ,
3939 selectedModelElementUrn : 'urn:samm:org.esmf.digitaltwin:2.1.0#Movement' ,
4040 enabledCommandBarFunctions : [ ] ,
4141 enableRemoteDataHandling : true ,
4242 enableVersionSupport : false ,
4343 overwrite : true ,
4444 templateHelper : new TemplateHelper ( ) ,
45+ spinner : {
46+ info : jest . fn ( ) ,
47+ warn : jest . fn ( )
48+ }
4549 } as any ) ;
4650} ) ;
4751
4852describe ( 'Generation of types from aspect model' , ( ) : void => {
49- it ( 'works for movement.ttl' , async function ( ) : Promise < void > {
53+ it ( 'works for movement.ttl' , async function ( ) : Promise < void > {
5054 const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/movement.ttl' )
5155 . then ( ( models : string [ ] ) : Promise < Aspect > => {
5256 return lastValueFrom ( loader . load ( '' , ...models ) ) ;
@@ -75,7 +79,7 @@ describe('Generation of types from aspect model', (): void => {
7579 expect ( generatedTypeDefinitions ) . toMatch ( / a l t i t u d e \s * \? : \s * n u m b e r \s * ; / ) ;
7680 } ) ;
7781
78- it ( 'works for built-in SAMM-C characteristics' , async function ( ) : Promise < void > {
82+ it ( 'works for built-in SAMM-C characteristics' , async function ( ) : Promise < void > {
7983 const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-sammc-characteristics.ttl' )
8084 . then ( ( models : string [ ] ) : Promise < Aspect > => {
8185 return lastValueFrom ( loader . load ( '' , ...models ) ) ;
@@ -92,7 +96,7 @@ describe('Generation of types from aspect model', (): void => {
9296 expect ( generatedTypeDefinitions ) . toMatch ( / c \s * : \s * D a t e \s * ; / ) ;
9397 } ) ;
9498
95- it ( 'works for XSD Core types' , async function ( ) : Promise < void > {
99+ it ( 'works for XSD Core types' , async function ( ) : Promise < void > {
96100 const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-xsd-core-types.ttl' )
97101 . then ( ( models : string [ ] ) : Promise < Aspect > => {
98102 return lastValueFrom ( loader . load ( '' , ...models ) ) ;
@@ -113,7 +117,7 @@ describe('Generation of types from aspect model', (): void => {
113117 expect ( generatedTypeDefinitions ) . toMatch ( / d \s * : \s * n u m b e r \s * ; / ) ;
114118 } ) ;
115119
116- it ( 'works for XSD Floating-Point Number types' , async function ( ) : Promise < void > {
120+ it ( 'works for XSD Floating-Point Number types' , async function ( ) : Promise < void > {
117121 const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-xsd-floating-point-number-types.ttl' )
118122 . then ( ( models : string [ ] ) : Promise < Aspect > => {
119123 return lastValueFrom ( loader . load ( '' , ...models ) ) ;
@@ -132,7 +136,7 @@ describe('Generation of types from aspect model', (): void => {
132136 expect ( generatedTypeDefinitions ) . toMatch ( / b \s * : \s * n u m b e r \s * ; / ) ;
133137 } ) ;
134138
135- it ( 'works for XSD Time and Date types' , async function ( ) : Promise < void > {
139+ it ( 'works for XSD Time and Date types' , async function ( ) : Promise < void > {
136140 const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-xsd-time-and-date-types.ttl' )
137141 . then ( ( models : string [ ] ) : Promise < Aspect > => {
138142 return lastValueFrom ( loader . load ( '' , ...models ) ) ;
@@ -153,7 +157,7 @@ describe('Generation of types from aspect model', (): void => {
153157 expect ( generatedTypeDefinitions ) . toMatch ( / d \s * : \s * D a t e \s * ; / ) ;
154158 } ) ;
155159
156- it ( 'works for XSD Limited-range Integer Number types' , async function ( ) : Promise < void > {
160+ it ( 'works for XSD Limited-range Integer Number types' , async function ( ) : Promise < void > {
157161 const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-xsd-limited-range-integer-number-types.ttl' )
158162 . then ( models => {
159163 return loader . load ( '' , ...models ) . toPromise ( ) ;
@@ -184,7 +188,7 @@ describe('Generation of types from aspect model', (): void => {
184188 expect ( generatedTypeDefinitions ) . toMatch ( / n p i \s * : \s * n u m b e r \s * ; / ) ;
185189 } ) ;
186190
187- it ( 'works for XSD Miscellaneous types' , async function ( ) : Promise < void > {
191+ it ( 'works for XSD Miscellaneous types' , async function ( ) : Promise < void > {
188192 const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-xsd-miscellaneous-types.ttl' )
189193 . then ( ( models : string [ ] ) : Promise < Aspect > => {
190194 return lastValueFrom ( loader . load ( '' , ...models ) ) ;
@@ -204,7 +208,7 @@ describe('Generation of types from aspect model', (): void => {
204208 expect ( generatedTypeDefinitions ) . toMatch ( / c \s * : \s * M u l t i L a n g u a g e T e x t \s * ; / ) ;
205209 } ) ;
206210
207- it ( 'works for enumeration types' , async function ( ) {
211+ it ( 'works for enumeration types' , async function ( ) {
208212 const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-enumeration-types.ttl' )
209213 . then ( models => {
210214 return loader . load ( '' , ...models ) . toPromise ( ) ;
@@ -231,17 +235,17 @@ describe('Generation of types from aspect model', (): void => {
231235 expect ( generatedTypeDefinitions ) . toMatch ( / N U M B E R _ 1 9 \s * = \s * 1 9 \s * , / ) ;
232236
233237 expect ( generatedTypeDefinitions ) . toMatch (
234- / s t a t i c S t a t u s I n P r o g r e s s \s * = \s * n e w P a r t S t a t u s \( \s * ' i n p r o g r e s s ' \s * , \s * 1 0 \s * , \s * \{ v a l u e : \s * ' I n P r o g r e s s ' \s * , \s * l a n g u a g e : \s * ' e n ' \s * \} \) ; / ,
238+ / s t a t i c S t a t u s I n P r o g r e s s \s * = \s * n e w P a r t S t a t u s \( \s * ' i n p r o g r e s s ' \s * , \s * 1 0 \s * , \s * \{ v a l u e : \s * ' I n P r o g r e s s ' \s * , \s * l a n g u a g e : \s * ' e n ' \s * \} \) ; /
235239 ) ;
236240 expect ( generatedTypeDefinitions ) . toMatch (
237- / s t a t i c S t a t u s C a n c e l l e d \s * = \s * n e w P a r t S t a t u s \( ' c a n c e l l e d ' \s * , \s * 1 1 \s * , \s * \{ v a l u e : \s * ' C a n c e l l e d ' , \s * l a n g u a g e : \s * ' e n ' \s * \} \) ; / ,
241+ / s t a t i c S t a t u s C a n c e l l e d \s * = \s * n e w P a r t S t a t u s \( ' c a n c e l l e d ' \s * , \s * 1 1 \s * , \s * \{ v a l u e : \s * ' C a n c e l l e d ' , \s * l a n g u a g e : \s * ' e n ' \s * \} \) ; /
238242 ) ;
239243 expect ( generatedTypeDefinitions ) . toMatch (
240- / s t a t i c S t a t u s I n a c t i v e \s * = \s * n e w P a r t S t a t u s \( ' i n a c t i v e ' , \s * 5 5 \s * , \s * \{ v a l u e : \s * ' C a n c e l l e d ' \s * , \s * l a n g u a g e : \s * ' e n ' \s * \} \) ; / ,
244+ / s t a t i c S t a t u s I n a c t i v e \s * = \s * n e w P a r t S t a t u s \( ' i n a c t i v e ' , \s * 5 5 \s * , \s * \{ v a l u e : \s * ' C a n c e l l e d ' \s * , \s * l a n g u a g e : \s * ' e n ' \s * \} \) ; /
241245 ) ;
242246 } ) ;
243247
244- it ( 'works for entity types' , async function ( ) : Promise < void > {
248+ it ( 'works for entity types' , async function ( ) : Promise < void > {
245249 const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-entity-types.ttl' )
246250 . then ( ( models : string [ ] ) : Promise < Aspect > => {
247251 return lastValueFrom ( loader . load ( '' , ...models ) ) ;
@@ -261,7 +265,7 @@ describe('Generation of types from aspect model', (): void => {
261265 expect ( generatedTypeDefinitions ) . toMatch ( / z \s * : \s * n u m b e r \s * ; / ) ;
262266 } ) ;
263267
264- it ( 'works for entity instances' , async function ( ) : Promise < void > {
268+ it ( 'works for entity instances' , async function ( ) : Promise < void > {
265269 const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-entity-instances.ttl' )
266270 . then ( ( models : string [ ] ) : Promise < Aspect > => {
267271 return lastValueFrom ( loader . load ( '' , ...models ) ) ;
@@ -282,7 +286,7 @@ describe('Generation of types from aspect model', (): void => {
282286 expect ( generatedTypeDefinitions ) . toMatch ( / d e s c r i p t i o n \s * : \s * s t r i n g \s * ; / ) ;
283287 } ) ;
284288
285- it ( 'works for entity instances with langString' , async function ( ) : Promise < void > {
289+ it ( 'works for entity instances with langString' , async function ( ) : Promise < void > {
286290 const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-entity-instances-with-langString.ttl' )
287291 . then ( ( models : string [ ] ) : Promise < Aspect > => {
288292 return lastValueFrom ( loader . load ( '' , ...models ) ) ;
@@ -297,17 +301,17 @@ describe('Generation of types from aspect model', (): void => {
297301 expect ( generatedTypeDefinitions ) . toMatch ( / e x p o r t i n t e r f a c e T e s t E n t i t y I n s t a n c e s W i t h L a n g S t r i n g / ) ;
298302 expect ( generatedTypeDefinitions ) . toMatch ( / e x p o r t c l a s s E n u m e r a t i o n / ) ;
299303 expect ( generatedTypeDefinitions ) . toMatch (
300- / s t a t i c C o d e 1 0 1 \s * = \s * n e w E n u m e r a t i o n \( \s * 1 0 1 \s * , \s * \{ v a l u e \s * : \s * ' S t a r t i n g ' \s * , \s * l a n g u a g e : \s * ' e n ' \} \) ; / ,
304+ / s t a t i c C o d e 1 0 1 \s * = \s * n e w E n u m e r a t i o n \( \s * 1 0 1 \s * , \s * \{ v a l u e \s * : \s * ' S t a r t i n g ' \s * , \s * l a n g u a g e : \s * ' e n ' \} \) ; /
301305 ) ;
302306 expect ( generatedTypeDefinitions ) . toMatch (
303- / s t a t i c C o d e 1 0 2 \s * = \s * n e w E n u m e r a t i o n \( \s * 1 0 2 \s * \s * , \s * \{ v a l u e \s * : \s * ' R e a d y ' , \s * l a n g u a g e : \s * ' e n ' \} \) ; / ,
307+ / s t a t i c C o d e 1 0 2 \s * = \s * n e w E n u m e r a t i o n \( \s * 1 0 2 \s * \s * , \s * \{ v a l u e \s * : \s * ' R e a d y ' , \s * l a n g u a g e : \s * ' e n ' \} \) ; /
304308 ) ;
305309 expect ( generatedTypeDefinitions ) . toMatch ( / s t e p \s * : \s * n u m b e r \s * ; / ) ;
306310 expect ( generatedTypeDefinitions ) . toMatch ( / e x p o r t i n t e r f a c e E n t i t y / ) ;
307311 expect ( generatedTypeDefinitions ) . toMatch ( / d e s c r i p t i o n \s * : \s * M u l t i L a n g u a g e T e x t \s * ; / ) ;
308312 } ) ;
309313
310- it ( 'works for entity instances with collection of langString' , async function ( ) : Promise < void > {
314+ it ( 'works for entity instances with collection of langString' , async function ( ) : Promise < void > {
311315 const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-entity-instances-with-collection-of-langString.ttl' )
312316 . then ( ( models : string [ ] ) : Promise < Aspect > => {
313317 return lastValueFrom ( loader . load ( '' , ...models ) ) ;
@@ -322,17 +326,17 @@ describe('Generation of types from aspect model', (): void => {
322326 expect ( generatedTypeDefinitions ) . toMatch ( / e x p o r t i n t e r f a c e T e s t E n t i t y I n s t a n c e s W i t h C o l l e c t i o n O f L a n g S t r i n g / ) ;
323327 expect ( generatedTypeDefinitions ) . toMatch ( / e x p o r t c l a s s E n u m e r a t i o n / ) ;
324328 expect ( generatedTypeDefinitions ) . toMatch (
325- / s t a t i c C o d e 1 0 1 \s * = \s * n e w E n u m e r a t i o n \s * \( \s * 1 0 1 \s * , \s * \( \s * \[ \s * \{ \s * v a l u e \s * : \s * ' S t a r t i n g ' \s * , \s * l a n g u a g e \s * : \s * ' e n ' \s * \} \s * , \s * \{ \s * v a l u e \s * : \s * ' S t a r t ' \s * , \s * l a n g u a g e \s * : \s * ' d e ' \s * \} \s * \] \s * a s \s + A r r a y < M u l t i L a n g u a g e T e x t > \s * \) \s * \) \s * ; / ,
329+ / s t a t i c C o d e 1 0 1 \s * = \s * n e w E n u m e r a t i o n \s * \( \s * 1 0 1 \s * , \s * \( \s * \[ \s * \{ \s * v a l u e \s * : \s * ' S t a r t i n g ' \s * , \s * l a n g u a g e \s * : \s * ' e n ' \s * \} \s * , \s * \{ \s * v a l u e \s * : \s * ' S t a r t ' \s * , \s * l a n g u a g e \s * : \s * ' d e ' \s * \} \s * \] \s * a s \s + A r r a y < M u l t i L a n g u a g e T e x t > \s * \) \s * \) \s * ; /
326330 ) ;
327331 expect ( generatedTypeDefinitions ) . toMatch (
328- / s t a t i c C o d e 1 0 2 \s * = \s * n e w E n u m e r a t i o n \s * \( \s * 1 0 2 \s * , \s * \( \s * \[ \s * \{ \s * v a l u e \s * : \s * ' R e a d y ' \s * , \s * l a n g u a g e \s * : \s * ' e n ' \s * \} \s * , \s * \{ \s * v a l u e \s * : \s * ' L o s ' \s * , \s * l a n g u a g e \s * : \s * ' d e ' \s * \} \s * \] \s * a s \s + A r r a y < M u l t i L a n g u a g e T e x t > \s * \) \s * \) \s * ; / ,
332+ / s t a t i c C o d e 1 0 2 \s * = \s * n e w E n u m e r a t i o n \s * \( \s * 1 0 2 \s * , \s * \( \s * \[ \s * \{ \s * v a l u e \s * : \s * ' R e a d y ' \s * , \s * l a n g u a g e \s * : \s * ' e n ' \s * \} \s * , \s * \{ \s * v a l u e \s * : \s * ' L o s ' \s * , \s * l a n g u a g e \s * : \s * ' d e ' \s * \} \s * \] \s * a s \s + A r r a y < M u l t i L a n g u a g e T e x t > \s * \) \s * \) \s * ; /
329333 ) ;
330334 expect ( generatedTypeDefinitions ) . toMatch ( / s t e p \s * : \s * n u m b e r \s * ; / ) ;
331335 expect ( generatedTypeDefinitions ) . toMatch ( / d e s c r i p t i o n \s * : \s * A r r a y < M u l t i L a n g u a g e T e x t > \s * ; / ) ;
332336 expect ( generatedTypeDefinitions ) . toMatch ( / e x p o r t i n t e r f a c e E n t i t y / ) ;
333337 } ) ;
334338
335- it ( 'works for collection types' , async function ( ) : Promise < void > {
339+ it ( 'works for collection types' , async function ( ) : Promise < void > {
336340 const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-collection-types.ttl' )
337341 . then ( ( models : string [ ] ) : Promise < Aspect > => {
338342 return lastValueFrom ( loader . load ( '' , ...models ) ) ;
@@ -353,7 +357,7 @@ describe('Generation of types from aspect model', (): void => {
353357 expect ( generatedTypeDefinitions ) . toMatch ( / p r o d u c t C l a s s \s * : \s * s t r i n g \s * ; / ) ;
354358 } ) ;
355359
356- it ( 'works for either types' , async function ( ) : Promise < void > {
360+ it ( 'works for either types' , async function ( ) : Promise < void > {
357361 const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-sammc-characteristics.ttl' )
358362 . then ( ( models : string [ ] ) : Promise < Aspect > => {
359363 return lastValueFrom ( loader . load ( '' , ...models ) ) ;
0 commit comments