@@ -24,7 +24,7 @@ let visitor: AspectModelTypeGeneratorVisitor;
24
24
25
25
const readFile = util . promisify ( fs . readFile ) ;
26
26
27
- beforeEach ( function ( ) {
27
+ beforeEach ( function ( ) {
28
28
visitor = new AspectModelTypeGeneratorVisitor ( {
29
29
excludedProperties : [ ] ,
30
30
complexProps : [ ] ,
@@ -34,19 +34,23 @@ beforeEach(function () {
34
34
customRowActions : [ ] ,
35
35
addCommandBar : true ,
36
36
selectedModelElement : {
37
- name : 'Movement' ,
37
+ name : 'Movement'
38
38
} ,
39
39
selectedModelElementUrn : 'urn:samm:org.esmf.digitaltwin:2.1.0#Movement' ,
40
40
enabledCommandBarFunctions : [ ] ,
41
41
enableRemoteDataHandling : true ,
42
42
enableVersionSupport : false ,
43
43
overwrite : true ,
44
44
templateHelper : new TemplateHelper ( ) ,
45
+ spinner : {
46
+ info : jest . fn ( ) ,
47
+ warn : jest . fn ( )
48
+ }
45
49
} as any ) ;
46
50
} ) ;
47
51
48
52
describe ( '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 > {
50
54
const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/movement.ttl' )
51
55
. then ( ( models : string [ ] ) : Promise < Aspect > => {
52
56
return lastValueFrom ( loader . load ( '' , ...models ) ) ;
@@ -75,7 +79,7 @@ describe('Generation of types from aspect model', (): void => {
75
79
expect ( generatedTypeDefinitions ) . toMatch ( / a l t i t u d e \s * \? : \s * n u m b e r \s * ; / ) ;
76
80
} ) ;
77
81
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 > {
79
83
const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-sammc-characteristics.ttl' )
80
84
. then ( ( models : string [ ] ) : Promise < Aspect > => {
81
85
return lastValueFrom ( loader . load ( '' , ...models ) ) ;
@@ -92,7 +96,7 @@ describe('Generation of types from aspect model', (): void => {
92
96
expect ( generatedTypeDefinitions ) . toMatch ( / c \s * : \s * D a t e \s * ; / ) ;
93
97
} ) ;
94
98
95
- it ( 'works for XSD Core types' , async function ( ) : Promise < void > {
99
+ it ( 'works for XSD Core types' , async function ( ) : Promise < void > {
96
100
const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-xsd-core-types.ttl' )
97
101
. then ( ( models : string [ ] ) : Promise < Aspect > => {
98
102
return lastValueFrom ( loader . load ( '' , ...models ) ) ;
@@ -113,7 +117,7 @@ describe('Generation of types from aspect model', (): void => {
113
117
expect ( generatedTypeDefinitions ) . toMatch ( / d \s * : \s * n u m b e r \s * ; / ) ;
114
118
} ) ;
115
119
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 > {
117
121
const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-xsd-floating-point-number-types.ttl' )
118
122
. then ( ( models : string [ ] ) : Promise < Aspect > => {
119
123
return lastValueFrom ( loader . load ( '' , ...models ) ) ;
@@ -132,7 +136,7 @@ describe('Generation of types from aspect model', (): void => {
132
136
expect ( generatedTypeDefinitions ) . toMatch ( / b \s * : \s * n u m b e r \s * ; / ) ;
133
137
} ) ;
134
138
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 > {
136
140
const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-xsd-time-and-date-types.ttl' )
137
141
. then ( ( models : string [ ] ) : Promise < Aspect > => {
138
142
return lastValueFrom ( loader . load ( '' , ...models ) ) ;
@@ -153,7 +157,7 @@ describe('Generation of types from aspect model', (): void => {
153
157
expect ( generatedTypeDefinitions ) . toMatch ( / d \s * : \s * D a t e \s * ; / ) ;
154
158
} ) ;
155
159
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 > {
157
161
const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-xsd-limited-range-integer-number-types.ttl' )
158
162
. then ( models => {
159
163
return loader . load ( '' , ...models ) . toPromise ( ) ;
@@ -184,7 +188,7 @@ describe('Generation of types from aspect model', (): void => {
184
188
expect ( generatedTypeDefinitions ) . toMatch ( / n p i \s * : \s * n u m b e r \s * ; / ) ;
185
189
} ) ;
186
190
187
- it ( 'works for XSD Miscellaneous types' , async function ( ) : Promise < void > {
191
+ it ( 'works for XSD Miscellaneous types' , async function ( ) : Promise < void > {
188
192
const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-xsd-miscellaneous-types.ttl' )
189
193
. then ( ( models : string [ ] ) : Promise < Aspect > => {
190
194
return lastValueFrom ( loader . load ( '' , ...models ) ) ;
@@ -204,7 +208,7 @@ describe('Generation of types from aspect model', (): void => {
204
208
expect ( generatedTypeDefinitions ) . toMatch ( / c \s * : \s * M u l t i L a n g u a g e T e x t \s * ; / ) ;
205
209
} ) ;
206
210
207
- it ( 'works for enumeration types' , async function ( ) {
211
+ it ( 'works for enumeration types' , async function ( ) {
208
212
const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-enumeration-types.ttl' )
209
213
. then ( models => {
210
214
return loader . load ( '' , ...models ) . toPromise ( ) ;
@@ -231,17 +235,17 @@ describe('Generation of types from aspect model', (): void => {
231
235
expect ( generatedTypeDefinitions ) . toMatch ( / N U M B E R _ 1 9 \s * = \s * 1 9 \s * , / ) ;
232
236
233
237
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 * \} \) ; /
235
239
) ;
236
240
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 * \} \) ; /
238
242
) ;
239
243
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 * \} \) ; /
241
245
) ;
242
246
} ) ;
243
247
244
- it ( 'works for entity types' , async function ( ) : Promise < void > {
248
+ it ( 'works for entity types' , async function ( ) : Promise < void > {
245
249
const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-entity-types.ttl' )
246
250
. then ( ( models : string [ ] ) : Promise < Aspect > => {
247
251
return lastValueFrom ( loader . load ( '' , ...models ) ) ;
@@ -261,7 +265,7 @@ describe('Generation of types from aspect model', (): void => {
261
265
expect ( generatedTypeDefinitions ) . toMatch ( / z \s * : \s * n u m b e r \s * ; / ) ;
262
266
} ) ;
263
267
264
- it ( 'works for entity instances' , async function ( ) : Promise < void > {
268
+ it ( 'works for entity instances' , async function ( ) : Promise < void > {
265
269
const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-entity-instances.ttl' )
266
270
. then ( ( models : string [ ] ) : Promise < Aspect > => {
267
271
return lastValueFrom ( loader . load ( '' , ...models ) ) ;
@@ -282,7 +286,7 @@ describe('Generation of types from aspect model', (): void => {
282
286
expect ( generatedTypeDefinitions ) . toMatch ( / d e s c r i p t i o n \s * : \s * s t r i n g \s * ; / ) ;
283
287
} ) ;
284
288
285
- it ( 'works for entity instances with langString' , async function ( ) : Promise < void > {
289
+ it ( 'works for entity instances with langString' , async function ( ) : Promise < void > {
286
290
const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-entity-instances-with-langString.ttl' )
287
291
. then ( ( models : string [ ] ) : Promise < Aspect > => {
288
292
return lastValueFrom ( loader . load ( '' , ...models ) ) ;
@@ -297,17 +301,17 @@ describe('Generation of types from aspect model', (): void => {
297
301
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 / ) ;
298
302
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 / ) ;
299
303
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 ' \} \) ; /
301
305
) ;
302
306
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 ' \} \) ; /
304
308
) ;
305
309
expect ( generatedTypeDefinitions ) . toMatch ( / s t e p \s * : \s * n u m b e r \s * ; / ) ;
306
310
expect ( generatedTypeDefinitions ) . toMatch ( / e x p o r t i n t e r f a c e E n t i t y / ) ;
307
311
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 * ; / ) ;
308
312
} ) ;
309
313
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 > {
311
315
const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-entity-instances-with-collection-of-langString.ttl' )
312
316
. then ( ( models : string [ ] ) : Promise < Aspect > => {
313
317
return lastValueFrom ( loader . load ( '' , ...models ) ) ;
@@ -322,17 +326,17 @@ describe('Generation of types from aspect model', (): void => {
322
326
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 / ) ;
323
327
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 / ) ;
324
328
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 * ; /
326
330
) ;
327
331
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 * ; /
329
333
) ;
330
334
expect ( generatedTypeDefinitions ) . toMatch ( / s t e p \s * : \s * n u m b e r \s * ; / ) ;
331
335
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 * ; / ) ;
332
336
expect ( generatedTypeDefinitions ) . toMatch ( / e x p o r t i n t e r f a c e E n t i t y / ) ;
333
337
} ) ;
334
338
335
- it ( 'works for collection types' , async function ( ) : Promise < void > {
339
+ it ( 'works for collection types' , async function ( ) : Promise < void > {
336
340
const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-collection-types.ttl' )
337
341
. then ( ( models : string [ ] ) : Promise < Aspect > => {
338
342
return lastValueFrom ( loader . load ( '' , ...models ) ) ;
@@ -353,7 +357,7 @@ describe('Generation of types from aspect model', (): void => {
353
357
expect ( generatedTypeDefinitions ) . toMatch ( / p r o d u c t C l a s s \s * : \s * s t r i n g \s * ; / ) ;
354
358
} ) ;
355
359
356
- it ( 'works for either types' , async function ( ) : Promise < void > {
360
+ it ( 'works for either types' , async function ( ) : Promise < void > {
357
361
const generatedTypeDefinitions = await readModelsFromFS ( 'test/models/test-sammc-characteristics.ttl' )
358
362
. then ( ( models : string [ ] ) : Promise < Aspect > => {
359
363
return lastValueFrom ( loader . load ( '' , ...models ) ) ;
0 commit comments