@likec4/generators 1.31.0 → 1.32.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/d2/generate-d2.d.ts +3 -2
  2. package/dist/d2/generate-d2.js +2 -1
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.js +1 -0
  5. package/dist/mmd/generate-mmd.d.ts +3 -2
  6. package/dist/mmd/generate-mmd.js +2 -1
  7. package/dist/model/generate-aux.d.ts +2 -0
  8. package/dist/model/generate-aux.js +66 -0
  9. package/dist/model/generate-likec4-model.d.ts +2 -2
  10. package/dist/model/generate-likec4-model.js +8 -10
  11. package/dist/puml/generate-puml.d.ts +2 -0
  12. package/dist/puml/generate-puml.js +176 -0
  13. package/dist/puml/index.d.ts +1 -0
  14. package/dist/puml/index.js +1 -0
  15. package/dist/react/generate-react-types.d.ts +2 -2
  16. package/dist/react/generate-react-types.js +14 -73
  17. package/dist/views-data-ts/generate-views-data.d.ts +9 -0
  18. package/package.json +7 -7
  19. package/src/__mocks__/data.ts +83 -83
  20. package/src/d2/__snapshots__/generate-d2.spec.ts.snap +78 -0
  21. package/src/d2/generate-d2.spec.ts +91 -4
  22. package/src/d2/generate-d2.ts +20 -15
  23. package/src/index.ts +1 -0
  24. package/src/mmd/generate-mmd.spec.ts +12 -4
  25. package/src/mmd/generate-mmd.ts +25 -20
  26. package/src/model/__snapshots__/aux.generate-valid-code.snap +56 -0
  27. package/src/model/__snapshots__/{likec4-model.snap → likec4.computed-model.snap} +342 -165
  28. package/src/model/__snapshots__/likec4.parsed-model.snap +671 -0
  29. package/src/model/generate-aux.spec.ts +65 -0
  30. package/src/model/generate-aux.ts +72 -0
  31. package/src/model/generate-likec4-model.spec.ts +34 -8
  32. package/src/model/generate-likec4-model.ts +13 -14
  33. package/src/puml/__snapshots__/generate-puml.spec.ts.snap +184 -0
  34. package/src/puml/generate-puml.spec.ts +26 -0
  35. package/src/puml/generate-puml.ts +264 -0
  36. package/src/puml/index.ts +1 -0
  37. package/src/react/__snapshots__/valid-code.snap +111 -0
  38. package/src/react/generate-react-types.spec.ts +67 -0
  39. package/src/react/generate-react-types.ts +16 -77
  40. package/src/views-data-ts/generate-views-data.ts +18 -9
@@ -1,4 +1,4 @@
1
- import type { ComputedView, DiagramView } from '@likec4/core'
1
+ import type { ComputedView, DiagramView } from '@likec4/core/types'
2
2
 
3
3
  export const fakeDiagram: DiagramView = {
4
4
  edges: [
@@ -6,7 +6,7 @@ export const fakeDiagram: DiagramView = {
6
6
  headArrow: [
7
7
  [294, 487],
8
8
  [291, 496],
9
- [288, 487]
9
+ [288, 487],
10
10
  ],
11
11
  id: 'cloud.frontend:cloud.backend',
12
12
  label: 'requests',
@@ -14,26 +14,26 @@ export const fakeDiagram: DiagramView = {
14
14
  align: 'left',
15
15
  width: 62,
16
16
  x: 295,
17
- y: 459
17
+ y: 459,
18
18
  },
19
19
  points: [
20
20
  [291, 406],
21
21
  [291, 432],
22
22
  [291, 461],
23
- [291, 487]
23
+ [291, 487],
24
24
  ],
25
25
  relations: [
26
26
  'cloud.frontend.dashboard:cloud.backend.graphql',
27
- 'cloud.frontend.adminPanel:cloud.backend.graphql'
27
+ 'cloud.frontend.adminPanel:cloud.backend.graphql',
28
28
  ],
29
29
  source: 'cloud.frontend',
30
- target: 'cloud.backend'
30
+ target: 'cloud.backend',
31
31
  },
32
32
  {
33
33
  headArrow: [
34
34
  [294, 701],
35
35
  [291, 711],
36
- [288, 701]
36
+ [288, 701],
37
37
  ],
38
38
  id: 'cloud.backend:amazon',
39
39
  label: null,
@@ -42,17 +42,17 @@ export const fakeDiagram: DiagramView = {
42
42
  [291, 641],
43
43
  [291, 660],
44
44
  [291, 681],
45
- [291, 702]
45
+ [291, 702],
46
46
  ],
47
47
  relations: ['cloud.backend.storage:amazon.s3'],
48
48
  source: 'cloud.backend',
49
- target: 'amazon'
49
+ target: 'amazon',
50
50
  },
51
51
  {
52
52
  headArrow: [
53
53
  [344, 257],
54
54
  [336, 263],
55
- [338, 253]
55
+ [338, 253],
56
56
  ],
57
57
  id: 'support:cloud.frontend',
58
58
  label: null,
@@ -61,17 +61,17 @@ export const fakeDiagram: DiagramView = {
61
61
  [413, 141],
62
62
  [391, 176],
63
63
  [364, 218],
64
- [342, 255]
64
+ [342, 255],
65
65
  ],
66
66
  relations: ['support:cloud.frontend.adminPanel'],
67
67
  source: 'support',
68
- target: 'cloud.frontend'
68
+ target: 'cloud.frontend',
69
69
  },
70
70
  {
71
71
  headArrow: [
72
72
  [244, 253],
73
73
  [246, 263],
74
- [239, 257]
74
+ [239, 257],
75
75
  ],
76
76
  id: 'customer:cloud.frontend',
77
77
  label: 'opens',
@@ -79,18 +79,18 @@ export const fakeDiagram: DiagramView = {
79
79
  align: 'left',
80
80
  width: 44,
81
81
  x: 208,
82
- y: 193
82
+ y: 193,
83
83
  },
84
84
  points: [
85
85
  [169, 141],
86
86
  [191, 176],
87
87
  [218, 218],
88
- [241, 255]
88
+ [241, 255],
89
89
  ],
90
90
  relations: ['customer:cloud.frontend.dashboard'],
91
91
  source: 'customer',
92
- target: 'cloud.frontend'
93
- }
92
+ target: 'cloud.frontend',
93
+ },
94
94
  ],
95
95
  height: 855,
96
96
  id: 'fakeView',
@@ -105,9 +105,9 @@ export const fakeDiagram: DiagramView = {
105
105
  shape: 'rectangle',
106
106
  size: {
107
107
  height: 140,
108
- width: 251
108
+ width: 251,
109
109
  },
110
- title: 'amazon'
110
+ title: 'amazon',
111
111
  },
112
112
  {
113
113
  children: ['cloud.backend', 'cloud.frontend'],
@@ -119,9 +119,9 @@ export const fakeDiagram: DiagramView = {
119
119
  shape: 'rectangle',
120
120
  size: {
121
121
  height: 457,
122
- width: 304
122
+ width: 304,
123
123
  },
124
- title: 'cloud'
124
+ title: 'cloud',
125
125
  },
126
126
  {
127
127
  children: [],
@@ -133,9 +133,9 @@ export const fakeDiagram: DiagramView = {
133
133
  shape: 'rectangle',
134
134
  size: {
135
135
  height: 140,
136
- width: 251
136
+ width: 251,
137
137
  },
138
- title: 'customer'
138
+ title: 'customer',
139
139
  },
140
140
  {
141
141
  children: [],
@@ -147,9 +147,9 @@ export const fakeDiagram: DiagramView = {
147
147
  shape: 'rectangle',
148
148
  size: {
149
149
  height: 140,
150
- width: 251
150
+ width: 251,
151
151
  },
152
- title: 'support'
152
+ title: 'support',
153
153
  },
154
154
  {
155
155
  children: [],
@@ -161,9 +161,9 @@ export const fakeDiagram: DiagramView = {
161
161
  shape: 'rectangle',
162
162
  size: {
163
163
  height: 140,
164
- width: 251
164
+ width: 251,
165
165
  },
166
- title: 'backend'
166
+ title: 'backend',
167
167
  },
168
168
  {
169
169
  children: [],
@@ -175,25 +175,25 @@ export const fakeDiagram: DiagramView = {
175
175
  shape: 'rectangle',
176
176
  size: {
177
177
  height: 140,
178
- width: 251
178
+ width: 251,
179
179
  },
180
- title: 'frontend'
181
- }
180
+ title: 'frontend',
181
+ },
182
182
  ],
183
183
  autoLayout: { direction: 'TB' },
184
184
  rules: [
185
185
  {
186
186
  exprs: [
187
187
  {
188
- wildcard: true
189
- }
188
+ wildcard: true,
189
+ },
190
190
  ],
191
- isInclude: true
192
- }
191
+ isInclude: true,
192
+ },
193
193
  ],
194
194
  title: '',
195
195
  viewOf: 'cloud',
196
- width: 582
196
+ width: 582,
197
197
  } as any
198
198
 
199
199
  export const fakeDiagram2: DiagramView = {
@@ -202,7 +202,7 @@ export const fakeDiagram2: DiagramView = {
202
202
  headArrow: [
203
203
  [129, 456],
204
204
  [126, 465],
205
- [123, 456]
205
+ [123, 456],
206
206
  ],
207
207
  id: 'system.frontend:system.backend',
208
208
  label: 'requests',
@@ -210,23 +210,23 @@ export const fakeDiagram2: DiagramView = {
210
210
  align: 'left',
211
211
  width: 62,
212
212
  x: 130,
213
- y: 428
213
+ y: 428,
214
214
  },
215
215
  points: [
216
216
  [126, 375],
217
217
  [126, 400],
218
218
  [126, 429],
219
- [126, 456]
219
+ [126, 456],
220
220
  ],
221
221
  relations: ['671e3db5eb605d5f245f247d95925bd0953e0e4c'],
222
222
  source: 'system.frontend',
223
- target: 'system.backend'
223
+ target: 'system.backend',
224
224
  },
225
225
  {
226
226
  headArrow: [
227
227
  [129, 221],
228
228
  [126, 231],
229
- [123, 221]
229
+ [123, 221],
230
230
  ],
231
231
  id: 'client:system.frontend',
232
232
  label: 'opens',
@@ -234,18 +234,18 @@ export const fakeDiagram2: DiagramView = {
234
234
  align: 'left',
235
235
  width: 44,
236
236
  x: 130,
237
- y: 193
237
+ y: 193,
238
238
  },
239
239
  points: [
240
240
  [126, 141],
241
241
  [126, 166],
242
242
  [126, 195],
243
- [126, 221]
243
+ [126, 221],
244
244
  ],
245
245
  relations: ['99bffdfd5c78e024393e6223cd9b19225321a5e3'],
246
246
  source: 'client',
247
- target: 'system.frontend'
248
- }
247
+ target: 'system.frontend',
248
+ },
249
249
  ],
250
250
  height: 609,
251
251
  id: '74f5364fa4b',
@@ -260,9 +260,9 @@ export const fakeDiagram2: DiagramView = {
260
260
  shape: 'rectangle',
261
261
  size: {
262
262
  height: 140,
263
- width: 251
263
+ width: 251,
264
264
  },
265
- title: 'client'
265
+ title: 'client',
266
266
  },
267
267
  {
268
268
  children: [],
@@ -274,9 +274,9 @@ export const fakeDiagram2: DiagramView = {
274
274
  shape: 'rectangle',
275
275
  size: {
276
276
  height: 140,
277
- width: 251
277
+ width: 251,
278
278
  },
279
- title: 'backend'
279
+ title: 'backend',
280
280
  },
281
281
  {
282
282
  children: [],
@@ -288,25 +288,25 @@ export const fakeDiagram2: DiagramView = {
288
288
  shape: 'rectangle',
289
289
  size: {
290
290
  height: 140,
291
- width: 251
291
+ width: 251,
292
292
  },
293
- title: 'frontend'
294
- }
293
+ title: 'frontend',
294
+ },
295
295
  ],
296
296
  autoLayout: { direction: 'TB' },
297
297
  rules: [
298
298
  {
299
299
  exprs: [
300
300
  {
301
- wildcard: true
302
- }
301
+ wildcard: true,
302
+ },
303
303
  ],
304
- isInclude: true
305
- }
304
+ isInclude: true,
305
+ },
306
306
  ],
307
307
  title: 'frontend',
308
308
  viewOf: 'system.frontend',
309
- width: 251
309
+ width: 251,
310
310
  } as any
311
311
 
312
312
  export const fakeComputedView3Levels: ComputedView = {
@@ -316,43 +316,43 @@ export const fakeComputedView3Levels: ComputedView = {
316
316
  label: null,
317
317
  relations: ['cloud.frontend.dashboard:cloud.backend.graphql'],
318
318
  source: 'cloud.frontend.dashboard',
319
- target: 'cloud.backend.graphql'
319
+ target: 'cloud.backend.graphql',
320
320
  },
321
321
  {
322
322
  id: 'cloud.frontend.adminPanel:cloud.backend.graphql',
323
323
  label: null,
324
324
  relations: ['cloud.frontend.adminPanel:cloud.backend.graphql'],
325
325
  source: 'cloud.frontend.adminPanel',
326
- target: 'cloud.backend.graphql'
326
+ target: 'cloud.backend.graphql',
327
327
  },
328
328
  {
329
329
  id: 'cloud.backend.storage:amazon',
330
330
  label: null,
331
331
  relations: ['cloud.backend.storage:amazon.s3'],
332
332
  source: 'cloud.backend.storage',
333
- target: 'amazon'
333
+ target: 'amazon',
334
334
  },
335
335
  {
336
336
  id: 'cloud.backend.graphql:cloud.backend.storage',
337
337
  label: null,
338
338
  relations: ['cloud.backend.graphql:cloud.backend.storage'],
339
339
  source: 'cloud.backend.graphql',
340
- target: 'cloud.backend.storage'
340
+ target: 'cloud.backend.storage',
341
341
  },
342
342
  {
343
343
  id: 'support:cloud.frontend.adminPanel',
344
344
  label: null,
345
345
  relations: ['support:cloud.frontend.adminPanel'],
346
346
  source: 'support',
347
- target: 'cloud.frontend.adminPanel'
347
+ target: 'cloud.frontend.adminPanel',
348
348
  },
349
349
  {
350
350
  id: 'customer:cloud.frontend.dashboard',
351
351
  label: null,
352
352
  relations: ['customer:cloud.frontend.dashboard'],
353
353
  source: 'customer',
354
- target: 'cloud.frontend.dashboard'
355
- }
354
+ target: 'cloud.frontend.dashboard',
355
+ },
356
356
  ],
357
357
  id: 'cloud3levels',
358
358
  nodes: [
@@ -362,7 +362,7 @@ export const fakeComputedView3Levels: ComputedView = {
362
362
  id: 'amazon',
363
363
  parent: null,
364
364
  shape: 'rectangle',
365
- title: 'amazon'
365
+ title: 'amazon',
366
366
  },
367
367
  {
368
368
  children: ['cloud.backend', 'cloud.frontend.adminPanel', 'cloud.frontend.dashboard'],
@@ -371,7 +371,7 @@ export const fakeComputedView3Levels: ComputedView = {
371
371
  navigateTo: 'fakeView',
372
372
  parent: null,
373
373
  shape: 'rectangle',
374
- title: 'cloud'
374
+ title: 'cloud',
375
375
  },
376
376
  {
377
377
  children: [],
@@ -379,7 +379,7 @@ export const fakeComputedView3Levels: ComputedView = {
379
379
  id: 'customer',
380
380
  parent: null,
381
381
  shape: 'rectangle',
382
- title: 'customer'
382
+ title: 'customer',
383
383
  },
384
384
  {
385
385
  children: [],
@@ -387,7 +387,7 @@ export const fakeComputedView3Levels: ComputedView = {
387
387
  id: 'support',
388
388
  parent: null,
389
389
  shape: 'rectangle',
390
- title: 'support'
390
+ title: 'support',
391
391
  },
392
392
  {
393
393
  children: ['cloud.backend.graphql', 'cloud.backend.storage'],
@@ -395,7 +395,7 @@ export const fakeComputedView3Levels: ComputedView = {
395
395
  id: 'cloud.backend',
396
396
  parent: 'cloud',
397
397
  shape: 'rectangle',
398
- title: 'backend'
398
+ title: 'backend',
399
399
  },
400
400
  {
401
401
  children: [],
@@ -403,7 +403,7 @@ export const fakeComputedView3Levels: ComputedView = {
403
403
  id: 'cloud.backend.graphql',
404
404
  parent: 'cloud.backend',
405
405
  shape: 'rectangle',
406
- title: 'graphql'
406
+ title: 'graphql',
407
407
  },
408
408
  {
409
409
  children: [],
@@ -411,7 +411,7 @@ export const fakeComputedView3Levels: ComputedView = {
411
411
  id: 'cloud.backend.storage',
412
412
  parent: 'cloud.backend',
413
413
  shape: 'rectangle',
414
- title: 'storage'
414
+ title: 'storage',
415
415
  },
416
416
  {
417
417
  children: [],
@@ -419,7 +419,7 @@ export const fakeComputedView3Levels: ComputedView = {
419
419
  id: 'cloud.frontend.adminPanel',
420
420
  parent: 'cloud',
421
421
  shape: 'rectangle',
422
- title: 'adminPanel'
422
+ title: 'adminPanel',
423
423
  },
424
424
  {
425
425
  children: [],
@@ -427,37 +427,37 @@ export const fakeComputedView3Levels: ComputedView = {
427
427
  id: 'cloud.frontend.dashboard',
428
428
  parent: 'cloud',
429
429
  shape: 'rectangle',
430
- title: 'dashboard'
431
- }
430
+ title: 'dashboard',
431
+ },
432
432
  ],
433
433
  autoLayout: { direction: 'TB' },
434
434
  rules: [
435
435
  {
436
436
  exprs: [
437
437
  {
438
- wildcard: true
438
+ wildcard: true,
439
439
  },
440
440
  {
441
441
  element: 'cloud.frontend',
442
- isChildren: true
442
+ isChildren: true,
443
443
  },
444
444
  {
445
445
  element: 'cloud.backend',
446
- isChildren: true
447
- }
446
+ isChildren: true,
447
+ },
448
448
  ],
449
- isInclude: true
449
+ isInclude: true,
450
450
  },
451
451
  {
452
452
  exprs: [
453
453
  {
454
454
  element: 'cloud.frontend',
455
- isChildren: false
456
- }
455
+ isChildren: false,
456
+ },
457
457
  ],
458
- isInclude: false
459
- }
458
+ isInclude: false,
459
+ },
460
460
  ],
461
461
  title: 'Context: Cloud',
462
- viewOf: 'cloud'
462
+ viewOf: 'cloud',
463
463
  } as any
@@ -1,5 +1,65 @@
1
1
  // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
+ exports[`generate D2 - element view 1`] = `
4
+ "direction: down
5
+
6
+ Alice: {
7
+ label: "Alice"
8
+ }
9
+ Bob: {
10
+ label: "Bob"
11
+ }
12
+ Cloud: {
13
+ label: "Cloud"
14
+
15
+ Frontend: {
16
+ label: "frontend"
17
+ }
18
+ Backend: {
19
+ label: "Backend"
20
+ }
21
+ }
22
+
23
+ Alice -> Cloud.Frontend: "uses \\n at home"
24
+ Bob -> Cloud.Frontend: "uses \\n at work"
25
+ Cloud.Frontend -> Cloud.Backend: "requests"
26
+ "
27
+ `;
28
+
29
+ exports[`generate D2 - element view 3 levels 1`] = `
30
+ "direction: down
31
+
32
+ Alice: {
33
+ label: "Alice"
34
+ }
35
+ Bob: {
36
+ label: "Bob"
37
+ }
38
+ Cloud: {
39
+ label: "Cloud"
40
+
41
+ Frontend: {
42
+ label: "frontend"
43
+ }
44
+ Backend: {
45
+ label: "Backend"
46
+
47
+ Api: {
48
+ label: "API"
49
+ }
50
+ Db: {
51
+ label: "DB"
52
+ }
53
+ }
54
+ }
55
+
56
+ Cloud.Frontend -> Cloud.Backend.Api: "requests"
57
+ Cloud.Backend.Api -> Cloud.Backend.Db
58
+ Alice -> Cloud.Frontend: "uses \\n at home"
59
+ Bob -> Cloud.Frontend: "uses \\n at work"
60
+ "
61
+ `;
62
+
3
63
  exports[`generate D2 - fakeComputedView 3 Levels 1`] = `
4
64
  "direction: down
5
65
 
@@ -89,3 +149,21 @@ SystemFrontend -> SystemBackend: "requests"
89
149
  Client -> SystemFrontend: "opens"
90
150
  "
91
151
  `;
152
+
153
+ exports[`generate D2 - landscape 1`] = `
154
+ "direction: down
155
+
156
+ Alice: {
157
+ label: "Alice"
158
+ }
159
+ Bob: {
160
+ label: "Bob"
161
+ }
162
+ Cloud: {
163
+ label: "Cloud"
164
+ }
165
+
166
+ Alice -> Cloud: "uses \\n at home"
167
+ Bob -> Cloud: "uses \\n at work"
168
+ "
169
+ `;
@@ -1,15 +1,102 @@
1
- import { expect, test } from 'vitest'
1
+ import { Builder } from '@likec4/core/builder'
2
+ import type { aux, LikeC4ViewModel } from '@likec4/core/model'
3
+ import type { LayoutedView, ProcessedView } from '@likec4/core/types'
4
+ import { expect, test, vi } from 'vitest'
2
5
  import { fakeComputedView3Levels, fakeDiagram, fakeDiagram2 } from '../__mocks__/data'
3
6
  import { generateD2 } from './generate-d2'
4
7
 
8
+ const b = Builder
9
+ .specification({
10
+ elements: {
11
+ actor: {},
12
+ system: {},
13
+ component: {},
14
+ },
15
+ deployments: {
16
+ env: {},
17
+ vm: {},
18
+ },
19
+ tags: {
20
+ t1: {},
21
+ },
22
+ })
23
+ .model(({ actor, system, component, rel }, _) =>
24
+ _(
25
+ actor('alice', 'Alice'),
26
+ actor('bob', 'Bob'),
27
+ system('cloud', 'Cloud').with(
28
+ component('backend', 'Backend').with(
29
+ component('api', 'API'),
30
+ component('db', 'DB'),
31
+ ),
32
+ component('frontend'),
33
+ ),
34
+ rel('alice', 'cloud.frontend', {
35
+ title: 'uses \n at home',
36
+ }),
37
+ rel('bob', 'cloud.frontend', {
38
+ title: 'uses \n at work',
39
+ }),
40
+ rel('cloud.backend.api', 'cloud.backend.db'),
41
+ rel('cloud.frontend', 'cloud.backend.api', {
42
+ title: 'requests',
43
+ tags: ['t1'],
44
+ }),
45
+ )
46
+ )
47
+ // Test Element View
48
+
49
+ test('generate D2 - landscape', () => {
50
+ const m = b
51
+ .views(({ view, $include }) =>
52
+ view('index', {
53
+ title: 'Layout',
54
+ description: 'description',
55
+ }).with(
56
+ $include('*'),
57
+ )
58
+ )
59
+ .toLikeC4Model()
60
+ expect(generateD2(m.view('index'))).toMatchSnapshot()
61
+ })
62
+
63
+ test('generate D2 - element view', () => {
64
+ const m = b
65
+ .views(({ viewOf, $include }) =>
66
+ viewOf('v1', 'cloud').with(
67
+ $include('*'),
68
+ )
69
+ )
70
+ .toLikeC4Model()
71
+ expect(generateD2(m.view('v1'))).toMatchSnapshot()
72
+ })
73
+
74
+ test('generate D2 - element view 3 levels', () => {
75
+ const m = b
76
+ .views(({ viewOf, $include }) =>
77
+ viewOf('v2', 'cloud.backend').with(
78
+ $include('*'),
79
+ $include('* -> cloud._'),
80
+ )
81
+ )
82
+ .toLikeC4Model()
83
+ expect(generateD2(m.view('v2'))).toMatchSnapshot()
84
+ })
85
+
86
+ const mockViewModel = vi.fn(function($view: ProcessedView) {
87
+ return {
88
+ $view,
89
+ } as unknown as LikeC4ViewModel<aux.Unknown, LayoutedView<aux.Unknown>>
90
+ })
91
+
5
92
  test('generate D2 - fakeDiagram', () => {
6
- expect(generateD2(fakeDiagram)).toMatchSnapshot()
93
+ expect(generateD2(mockViewModel(fakeDiagram))).toMatchSnapshot()
7
94
  })
8
95
 
9
96
  test('generate D2 - fakeDiagram2', () => {
10
- expect(generateD2(fakeDiagram2)).toMatchSnapshot()
97
+ expect(generateD2(mockViewModel(fakeDiagram2))).toMatchSnapshot()
11
98
  })
12
99
 
13
100
  test('generate D2 - fakeComputedView 3 Levels', () => {
14
- expect(generateD2(fakeComputedView3Levels)).toMatchSnapshot()
101
+ expect(generateD2(mockViewModel(fakeComputedView3Levels))).toMatchSnapshot()
15
102
  })