architecture-viewer 0.0.1-security → 4.4.5
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.
Potentially problematic release.
This version of architecture-viewer might be problematic. Click here for more details.
- package/2/package.json +10 -0
- package/2/postinstall.js +33 -0
- package/New Folder/architecture-viewer/.babelrc +9 -0
- package/New Folder/architecture-viewer/.whitesource +8 -0
- package/New Folder/architecture-viewer/CODEOWNERS +2 -0
- package/New Folder/architecture-viewer/LICENSE.txt +201 -0
- package/New Folder/architecture-viewer/README.md +238 -0
- package/New Folder/architecture-viewer/licenses.csv +40 -0
- package/New Folder/architecture-viewer/package-lock.json +16126 -0
- package/New Folder/architecture-viewer/package.json +60 -0
- package/New Folder/architecture-viewer/preact.config.js +62 -0
- package/New Folder/architecture-viewer/readme_resources/screenrecord_arch_diagram.gif +0 -0
- package/New Folder/architecture-viewer/sample_json_data/large_web.json +289 -0
- package/New Folder/architecture-viewer/sample_json_data/no_steps.json +185 -0
- package/New Folder/architecture-viewer/sample_json_data/readme_example.json +55 -0
- package/New Folder/architecture-viewer/sample_json_data/section_example.json +323 -0
- package/New Folder/architecture-viewer/sample_json_data/simple_structure.json +131 -0
- package/New Folder/architecture-viewer/sample_json_data/zones_example.json +445 -0
- package/New Folder/architecture-viewer/sample_plantuml_data/example.adoc +65 -0
- package/New Folder/architecture-viewer/sample_plantuml_data/example.png +0 -0
- package/New Folder/architecture-viewer/sample_plantuml_data/example.svg +1 -0
- package/New Folder/architecture-viewer/src/assets/data.json +445 -0
- package/New Folder/architecture-viewer/src/assets/favicon.ico +0 -0
- package/New Folder/architecture-viewer/src/assets/grid_data.json +1126 -0
- package/New Folder/architecture-viewer/src/assets/icons/android-chrome-192x192.png +0 -0
- package/New Folder/architecture-viewer/src/assets/icons/android-chrome-512x512.png +0 -0
- package/New Folder/architecture-viewer/src/assets/icons/apple-touch-icon.png +0 -0
- package/New Folder/architecture-viewer/src/assets/icons/favicon-16x16.png +0 -0
- package/New Folder/architecture-viewer/src/assets/icons/favicon-32x32.png +0 -0
- package/New Folder/architecture-viewer/src/assets/icons/info.png +0 -0
- package/New Folder/architecture-viewer/src/assets/icons/mstile-150x150.png +0 -0
- package/New Folder/architecture-viewer/src/assets/test_data.json +32 -0
- package/New Folder/architecture-viewer/src/components/app.js +231 -0
- package/New Folder/architecture-viewer/src/components/controls.js +195 -0
- package/New Folder/architecture-viewer/src/components/diagram.js +362 -0
- package/New Folder/architecture-viewer/src/components/diagramArea.js +68 -0
- package/New Folder/architecture-viewer/src/components/info.js +37 -0
- package/New Folder/architecture-viewer/src/components/infoArea.js +75 -0
- package/New Folder/architecture-viewer/src/components/key.js +42 -0
- package/New Folder/architecture-viewer/src/components/tableOfContents.js +112 -0
- package/New Folder/architecture-viewer/src/components/tocStep.js +100 -0
- package/New Folder/architecture-viewer/src/components/zoneLegend.js +55 -0
- package/New Folder/architecture-viewer/src/index.js +20 -0
- package/New Folder/architecture-viewer/src/manifest.json +19 -0
- package/New Folder/architecture-viewer/src/routes/home/index.js +29 -0
- package/New Folder/architecture-viewer/src/routes/home/style.less +23 -0
- package/New Folder/architecture-viewer/src/routes/profile/index.js +63 -0
- package/New Folder/architecture-viewer/src/routes/profile/style.less +23 -0
- package/New Folder/architecture-viewer/src/style/helpers.less +40 -0
- package/New Folder/architecture-viewer/src/style/index.css +224 -0
- package/New Folder/architecture-viewer/src/style/jquery.qtip.less +623 -0
- package/New Folder/architecture-viewer/src/sw.js +4 -0
- package/New Folder/architecture-viewer/src/template.html +15 -0
- package/New Folder/architecture-viewer/src/utils/dataValidator.js +333 -0
- package/New Folder/architecture-viewer/src/utils/parser.js +623 -0
- package/New Folder/architecture-viewer/src/utils/stepUtils.js +30 -0
- package/New Folder/architecture-viewer/tests/__mocks__/browserMocks.js +21 -0
- package/New Folder/architecture-viewer/tests/__mocks__/fileMocks.js +3 -0
- package/New Folder/architecture-viewer/tests/__mocks__/setupTests.js +6 -0
- package/New Folder/architecture-viewer/tests/parser.test.js +799 -0
- package/New Folder/architecture-viewer/tests/testfiles/aliased_participants.adoc +7 -0
- package/New Folder/architecture-viewer/tests/testfiles/bigspace.json +1 -0
- package/New Folder/architecture-viewer/tests/testfiles/dividers.adoc +18 -0
- package/New Folder/architecture-viewer/tests/testfiles/doubled_names.adoc +10 -0
- package/New Folder/architecture-viewer/tests/testfiles/empty.adoc +2 -0
- package/New Folder/architecture-viewer/tests/testfiles/meta.adoc +19 -0
- package/New Folder/architecture-viewer/tests/testfiles/notes_multiline.adoc +17 -0
- package/New Folder/architecture-viewer/tests/testfiles/notes_singleline.adoc +16 -0
- package/New Folder/architecture-viewer/tests/testfiles/parsefile.adoc +6 -0
- package/New Folder/architecture-viewer/tests/testfiles/participant_decl.adoc +6 -0
- package/New Folder/architecture-viewer/tests/testfiles/participant_info.adoc +7 -0
- package/New Folder/architecture-viewer/tests/testfiles/readme.adoc +7 -0
- package/New Folder/architecture-viewer/tests/testfiles/steps_aliased.adoc +9 -0
- package/New Folder/architecture-viewer/tests/testfiles/steps_group.adoc +16 -0
- package/New Folder/architecture-viewer/tests/testfiles/steps_group.json +1 -0
- package/New Folder/architecture-viewer/tests/testfiles/steps_group_mixed.adoc +16 -0
- package/New Folder/architecture-viewer/tests/testfiles/steps_group_mixed.json +1 -0
- package/New Folder/architecture-viewer/tests/testfiles/steps_loop.adoc +16 -0
- package/New Folder/architecture-viewer/tests/testfiles/steps_loop.json +1 -0
- package/New Folder/architecture-viewer/tests/testfiles/steps_mixed.adoc +9 -0
- package/New Folder/architecture-viewer/tests/testfiles/steps_steptest.adoc +17 -0
- package/New Folder/architecture-viewer/tests/testfiles/steps_unaliased.adoc +9 -0
- package/New Folder/architecture-viewer/tests/testfiles/supernodes.adoc +10 -0
- package/New Folder/architecture-viewer/tests/testfiles/unaliased_participants.adoc +6 -0
- package/New Folder/architecture-viewer/tests/testfiles/undeclaredparticipant.adoc +23 -0
- package/New Folder/architecture-viewer/tests/testfiles/xsstest.adoc +15 -0
- package/New Folder/architecture-viewer/tests/testfiles/zoned_participants.adoc +5 -0
- package/New Folder/architecture-viewer/tests/validator.test.js +63 -0
- package/New Folder/d_i.txt +1 -0
- package/New Folder/dependency_confution_npm.sh +70 -0
- package/New Folder/licenses.csv +40 -0
- package/New Folder/npm_sub.txt +0 -0
- package/New Folder/package-lock.json +23 -0
- package/New Folder/package.json.save +12 -0
- package/index.js +39 -0
- package/package.json +12 -3
- package/README.md +0 -5
@@ -0,0 +1,799 @@
|
|
1
|
+
const parser = require("../src/utils/parser");
|
2
|
+
|
3
|
+
|
4
|
+
describe("file processor", () => {
|
5
|
+
it("should create an empty structure given an empty file", () => {
|
6
|
+
const empty = {
|
7
|
+
title: "",
|
8
|
+
graphData: {
|
9
|
+
nodes: [],
|
10
|
+
edges: []
|
11
|
+
},
|
12
|
+
stepData: [],
|
13
|
+
zoneData: []
|
14
|
+
};
|
15
|
+
|
16
|
+
const contents = require("./testfiles/empty.adoc").split("\n");
|
17
|
+
const data = parser.parseContents(contents);
|
18
|
+
|
19
|
+
expect(data).toEqual(empty);
|
20
|
+
});
|
21
|
+
|
22
|
+
/*
|
23
|
+
THE PARTICIPANT FEATURE
|
24
|
+
*/
|
25
|
+
it("should create nodes given only participants (without aliases)",() => {
|
26
|
+
const expected = [
|
27
|
+
{
|
28
|
+
data: {
|
29
|
+
id: "A",
|
30
|
+
fname: "A",
|
31
|
+
zone: "#FBDCD6"
|
32
|
+
}
|
33
|
+
},
|
34
|
+
{
|
35
|
+
data: {
|
36
|
+
id: "B",
|
37
|
+
fname: "B",
|
38
|
+
zone: "#FBDCD6"
|
39
|
+
}
|
40
|
+
},
|
41
|
+
{
|
42
|
+
data: {
|
43
|
+
id: "C",
|
44
|
+
fname: "C",
|
45
|
+
zone: "#FBDCD6"
|
46
|
+
}
|
47
|
+
}
|
48
|
+
];
|
49
|
+
|
50
|
+
const contents = require("./testfiles/unaliased_participants.adoc").split("\n");
|
51
|
+
const data = parser.parseContents(contents);
|
52
|
+
|
53
|
+
expect(data.graphData.nodes).toEqual(expected);
|
54
|
+
|
55
|
+
|
56
|
+
});
|
57
|
+
it("should create nodes given only participants (with aliases)", () => {
|
58
|
+
const expected = [
|
59
|
+
{
|
60
|
+
data: {
|
61
|
+
id: "A",
|
62
|
+
fname: "A",
|
63
|
+
zone: "#FBDCD6"
|
64
|
+
}
|
65
|
+
},
|
66
|
+
{
|
67
|
+
data: {
|
68
|
+
id: "B",
|
69
|
+
fname: "B B B",
|
70
|
+
zone: "#FBDCD6"
|
71
|
+
}
|
72
|
+
},
|
73
|
+
{
|
74
|
+
data: {
|
75
|
+
id: "C",
|
76
|
+
fname: "C",
|
77
|
+
zone: "#FBDCD6"
|
78
|
+
}
|
79
|
+
},
|
80
|
+
{
|
81
|
+
data: {
|
82
|
+
id: "D",
|
83
|
+
fname: "D D D",
|
84
|
+
zone: "#FBDCD6"
|
85
|
+
}
|
86
|
+
},
|
87
|
+
];
|
88
|
+
|
89
|
+
const contents = require("./testfiles/aliased_participants.adoc").split("\n");
|
90
|
+
const data = parser.parseContents(contents);
|
91
|
+
|
92
|
+
expect(data.graphData.nodes).toEqual(expected);
|
93
|
+
|
94
|
+
});
|
95
|
+
it("should support participant creation through 'participant' and 'actor'", () => {
|
96
|
+
const expected = [
|
97
|
+
{
|
98
|
+
data: {
|
99
|
+
id: "A",
|
100
|
+
fname: "A",
|
101
|
+
zone: "#FBDCD6"
|
102
|
+
}
|
103
|
+
},
|
104
|
+
{
|
105
|
+
data: {
|
106
|
+
id: "B",
|
107
|
+
fname: "B B B",
|
108
|
+
zone: "#FBDCD6"
|
109
|
+
}
|
110
|
+
},
|
111
|
+
{
|
112
|
+
data: {
|
113
|
+
id: "C",
|
114
|
+
fname: "C",
|
115
|
+
zone: "#FBDCD6"
|
116
|
+
}
|
117
|
+
}
|
118
|
+
];
|
119
|
+
|
120
|
+
const contents = require("./testfiles/participant_decl.adoc").split("\n");
|
121
|
+
const data = parser.parseContents(contents);
|
122
|
+
|
123
|
+
expect(data.graphData.nodes).toEqual(expected);
|
124
|
+
});
|
125
|
+
|
126
|
+
it("should support applying zones to participants", () => {
|
127
|
+
|
128
|
+
const expectedNodes = [
|
129
|
+
{
|
130
|
+
data: {
|
131
|
+
id: "A",
|
132
|
+
fname: "A",
|
133
|
+
zone: "#111",
|
134
|
+
parent: "zoneA"
|
135
|
+
}
|
136
|
+
},
|
137
|
+
{
|
138
|
+
data: {
|
139
|
+
id: "B",
|
140
|
+
fname: "BBB",
|
141
|
+
zone: "#222",
|
142
|
+
parent: "zoneB"
|
143
|
+
}
|
144
|
+
},
|
145
|
+
{
|
146
|
+
data: {
|
147
|
+
id: "C",
|
148
|
+
fname: "C",
|
149
|
+
zone: "#FBDCD6"
|
150
|
+
}
|
151
|
+
},
|
152
|
+
{
|
153
|
+
data: {
|
154
|
+
id: "zoneA",
|
155
|
+
zone: "#353535",
|
156
|
+
}
|
157
|
+
},
|
158
|
+
{
|
159
|
+
data: {
|
160
|
+
id: "zoneB",
|
161
|
+
zone: "#434343",
|
162
|
+
}
|
163
|
+
},
|
164
|
+
]
|
165
|
+
|
166
|
+
const contents = require("./testfiles/zoned_participants.adoc").split("\n");
|
167
|
+
const data = parser.parseContents(contents);
|
168
|
+
|
169
|
+
expect(data.graphData.nodes).toEqual(expectedNodes);
|
170
|
+
})
|
171
|
+
|
172
|
+
/*
|
173
|
+
THE STEPS FEATURE
|
174
|
+
*/
|
175
|
+
it("should create nodes, edges, stepData given unaliased participants and steps", () => {
|
176
|
+
const expectedEdges = [
|
177
|
+
{
|
178
|
+
data: {
|
179
|
+
id: "e0",
|
180
|
+
source: "A",
|
181
|
+
target: "B"
|
182
|
+
}
|
183
|
+
},
|
184
|
+
{
|
185
|
+
data: {
|
186
|
+
id: "e1",
|
187
|
+
source: "B",
|
188
|
+
target: "C"
|
189
|
+
}
|
190
|
+
}
|
191
|
+
];
|
192
|
+
|
193
|
+
const expectedSteps = [
|
194
|
+
{
|
195
|
+
id: "0",
|
196
|
+
type: "single",
|
197
|
+
nodes: ["A", "B"],
|
198
|
+
steps: [],
|
199
|
+
description: "AB",
|
200
|
+
note: ""
|
201
|
+
},
|
202
|
+
{
|
203
|
+
id: "1",
|
204
|
+
type: "single",
|
205
|
+
nodes: ["B", "C"],
|
206
|
+
steps: [],
|
207
|
+
description: "BC",
|
208
|
+
note: ""
|
209
|
+
},
|
210
|
+
];
|
211
|
+
|
212
|
+
const contents = require("./testfiles/steps_unaliased.adoc").split("\n");
|
213
|
+
const data = parser.parseContents(contents);
|
214
|
+
|
215
|
+
expect(data.graphData.edges).toEqual(expectedEdges);
|
216
|
+
expect(data.stepData).toEqual(expectedSteps);
|
217
|
+
});
|
218
|
+
|
219
|
+
it("should create nodes, edges, stepData given aliased participants and steps", () => {
|
220
|
+
const expectedEdges = [
|
221
|
+
{
|
222
|
+
data: {
|
223
|
+
id: "e0",
|
224
|
+
source: "A",
|
225
|
+
target: "B"
|
226
|
+
}
|
227
|
+
},
|
228
|
+
{
|
229
|
+
data: {
|
230
|
+
id: "e1",
|
231
|
+
source: "B",
|
232
|
+
target: "C"
|
233
|
+
}
|
234
|
+
}
|
235
|
+
];
|
236
|
+
|
237
|
+
const expectedSteps = [
|
238
|
+
{
|
239
|
+
id: "0",
|
240
|
+
type: "single",
|
241
|
+
nodes: ["A", "B"],
|
242
|
+
steps: [],
|
243
|
+
description: "AB",
|
244
|
+
note: ""
|
245
|
+
},
|
246
|
+
{
|
247
|
+
id: "1",
|
248
|
+
type: "single",
|
249
|
+
nodes: ["B", "C"],
|
250
|
+
steps: [],
|
251
|
+
description: "BC",
|
252
|
+
note: ""
|
253
|
+
},
|
254
|
+
];
|
255
|
+
|
256
|
+
const contents = require("./testfiles/steps_aliased.adoc").split("\n");
|
257
|
+
const data = parser.parseContents(contents);
|
258
|
+
|
259
|
+
expect(data.graphData.edges).toEqual(expectedEdges);
|
260
|
+
expect(data.stepData).toEqual(expectedSteps);
|
261
|
+
})
|
262
|
+
|
263
|
+
it("should create nodes, edges, stepData given mixed participants and steps", () => {
|
264
|
+
const expectedEdges = [
|
265
|
+
{
|
266
|
+
data: {
|
267
|
+
id: "e0",
|
268
|
+
source: "A",
|
269
|
+
target: "B"
|
270
|
+
}
|
271
|
+
},
|
272
|
+
{
|
273
|
+
data: {
|
274
|
+
id: "e1",
|
275
|
+
source: "B",
|
276
|
+
target: "C"
|
277
|
+
}
|
278
|
+
}
|
279
|
+
];
|
280
|
+
|
281
|
+
const expectedSteps = [
|
282
|
+
{
|
283
|
+
id: "0",
|
284
|
+
type: "single",
|
285
|
+
nodes: ["A", "B"],
|
286
|
+
steps: [],
|
287
|
+
description: "AB",
|
288
|
+
note: ""
|
289
|
+
},
|
290
|
+
{
|
291
|
+
id: "1",
|
292
|
+
type: "single",
|
293
|
+
nodes: ["B", "C"],
|
294
|
+
steps: [],
|
295
|
+
description: "BC",
|
296
|
+
note: ""
|
297
|
+
},
|
298
|
+
];
|
299
|
+
|
300
|
+
const contents = require("./testfiles/steps_mixed.adoc").split("\n");
|
301
|
+
const data = parser.parseContents(contents);
|
302
|
+
|
303
|
+
expect(data.graphData.edges).toEqual(expectedEdges);
|
304
|
+
expect(data.stepData).toEqual(expectedSteps);
|
305
|
+
})
|
306
|
+
|
307
|
+
it("should support all styles of step arrows", () => {
|
308
|
+
const expectedEdges = [
|
309
|
+
{
|
310
|
+
data: {
|
311
|
+
id: "e0",
|
312
|
+
source: "A",
|
313
|
+
target: "B"
|
314
|
+
}
|
315
|
+
}
|
316
|
+
];
|
317
|
+
|
318
|
+
const expectedSteps = [
|
319
|
+
{
|
320
|
+
id: "0",
|
321
|
+
type: "single",
|
322
|
+
nodes: ["A", "B"],
|
323
|
+
steps: [],
|
324
|
+
description: "AB1",
|
325
|
+
note: ""
|
326
|
+
},
|
327
|
+
{
|
328
|
+
id: "1",
|
329
|
+
type: "single",
|
330
|
+
nodes: ["A", "B"],
|
331
|
+
steps: [],
|
332
|
+
description: "AB2",
|
333
|
+
note: ""
|
334
|
+
},
|
335
|
+
{
|
336
|
+
id: "2",
|
337
|
+
type: "single",
|
338
|
+
nodes: ["A", "B"],
|
339
|
+
steps: [],
|
340
|
+
description: "AB3",
|
341
|
+
note: ""
|
342
|
+
},
|
343
|
+
{
|
344
|
+
id: "3",
|
345
|
+
type: "single",
|
346
|
+
nodes: ["A", "B"],
|
347
|
+
steps: [],
|
348
|
+
description: "AB4",
|
349
|
+
note: ""
|
350
|
+
},
|
351
|
+
{
|
352
|
+
id: "4",
|
353
|
+
type: "single",
|
354
|
+
nodes: ["A", "B"],
|
355
|
+
steps: [],
|
356
|
+
description: "AB5",
|
357
|
+
note: ""
|
358
|
+
},
|
359
|
+
{
|
360
|
+
id: "5",
|
361
|
+
type: "single",
|
362
|
+
nodes: ["A", "B"],
|
363
|
+
steps: [],
|
364
|
+
description: "AB6",
|
365
|
+
note: ""
|
366
|
+
},
|
367
|
+
{
|
368
|
+
id: "6",
|
369
|
+
type: "single",
|
370
|
+
nodes: ["A", "B"],
|
371
|
+
steps: [],
|
372
|
+
description: "AB7",
|
373
|
+
note: ""
|
374
|
+
},
|
375
|
+
{
|
376
|
+
id: "7",
|
377
|
+
type: "single",
|
378
|
+
nodes: ["A", "B"],
|
379
|
+
steps: [],
|
380
|
+
description: "AB8",
|
381
|
+
note: ""
|
382
|
+
},
|
383
|
+
{
|
384
|
+
id: "8",
|
385
|
+
type: "single",
|
386
|
+
nodes: ["A", "B"],
|
387
|
+
steps: [],
|
388
|
+
description: "AB9",
|
389
|
+
note: ""
|
390
|
+
},
|
391
|
+
{
|
392
|
+
id: "9",
|
393
|
+
type: "single",
|
394
|
+
nodes: ["A", "B"],
|
395
|
+
steps: [],
|
396
|
+
description: "AB10",
|
397
|
+
note: ""
|
398
|
+
},
|
399
|
+
{
|
400
|
+
id: "10",
|
401
|
+
type: "single",
|
402
|
+
nodes: ["A", "B"],
|
403
|
+
steps: [],
|
404
|
+
description: "AB11",
|
405
|
+
note: ""
|
406
|
+
},
|
407
|
+
];
|
408
|
+
|
409
|
+
const contents = require("./testfiles/steps_steptest.adoc").split("\n");
|
410
|
+
const data = parser.parseContents(contents);
|
411
|
+
|
412
|
+
expect(data.graphData.edges).toEqual(expectedEdges);
|
413
|
+
expect(data.stepData).toEqual(expectedSteps);
|
414
|
+
});
|
415
|
+
|
416
|
+
/*
|
417
|
+
THE GROUPING FEATURE
|
418
|
+
*/
|
419
|
+
it("should support the 'loop <message>' group keyword", () => {
|
420
|
+
|
421
|
+
const expectedSteps = [
|
422
|
+
{
|
423
|
+
id: "g0",
|
424
|
+
type: "group",
|
425
|
+
groupName: "loop",
|
426
|
+
nodes: [],
|
427
|
+
steps: [
|
428
|
+
{
|
429
|
+
id: "0",
|
430
|
+
type: "single",
|
431
|
+
nodes: [
|
432
|
+
"A",
|
433
|
+
"B"
|
434
|
+
],
|
435
|
+
steps: [],
|
436
|
+
description: "AB",
|
437
|
+
note: ""
|
438
|
+
},
|
439
|
+
{
|
440
|
+
id: "g1",
|
441
|
+
type: "group",
|
442
|
+
groupName: "loop",
|
443
|
+
nodes: [],
|
444
|
+
steps: [
|
445
|
+
{
|
446
|
+
id: "1",
|
447
|
+
type: "single",
|
448
|
+
nodes: [
|
449
|
+
"B",
|
450
|
+
"C"
|
451
|
+
],
|
452
|
+
steps: [],
|
453
|
+
description: "BC",
|
454
|
+
note: ""
|
455
|
+
}
|
456
|
+
],
|
457
|
+
description: "testloop2",
|
458
|
+
note: "loop note testloop2"
|
459
|
+
}
|
460
|
+
],
|
461
|
+
description: "testloop1",
|
462
|
+
note: "loop note testloop1"
|
463
|
+
}
|
464
|
+
];
|
465
|
+
|
466
|
+
const contents = require("./testfiles/steps_loop.adoc").split("\n");
|
467
|
+
const data = parser.parseContents(contents);
|
468
|
+
|
469
|
+
expect(data.stepData).toEqual(expectedSteps);
|
470
|
+
});
|
471
|
+
|
472
|
+
it("should support the 'group <text>' group keyword", () => {
|
473
|
+
const expectedSteps = [
|
474
|
+
{
|
475
|
+
id: "g0",
|
476
|
+
type: "group",
|
477
|
+
groupName: "group",
|
478
|
+
nodes: [],
|
479
|
+
steps: [
|
480
|
+
{
|
481
|
+
id: "0",
|
482
|
+
type: "single",
|
483
|
+
nodes: [
|
484
|
+
"A",
|
485
|
+
"B"
|
486
|
+
],
|
487
|
+
steps: [],
|
488
|
+
description: "AB",
|
489
|
+
note: ""
|
490
|
+
},
|
491
|
+
{
|
492
|
+
id: "g1",
|
493
|
+
type: "group",
|
494
|
+
groupName: "group",
|
495
|
+
nodes: [],
|
496
|
+
steps: [
|
497
|
+
{
|
498
|
+
id: "1",
|
499
|
+
type: "single",
|
500
|
+
nodes: [
|
501
|
+
"B",
|
502
|
+
"C"
|
503
|
+
],
|
504
|
+
steps: [],
|
505
|
+
description: "BC",
|
506
|
+
note: ""
|
507
|
+
}
|
508
|
+
],
|
509
|
+
description: "testgroup2",
|
510
|
+
note: "group note testgroup2"
|
511
|
+
}
|
512
|
+
],
|
513
|
+
description: "testgroup1",
|
514
|
+
note: "group note testgroup1"
|
515
|
+
}
|
516
|
+
];
|
517
|
+
|
518
|
+
const contents = require("./testfiles/steps_group.adoc").split("\n");
|
519
|
+
const data = parser.parseContents(contents);
|
520
|
+
|
521
|
+
expect(data.stepData).toEqual(expectedSteps);
|
522
|
+
});
|
523
|
+
|
524
|
+
it("should support mixed groups", () => {
|
525
|
+
const expectedSteps = [
|
526
|
+
{
|
527
|
+
id: "g0",
|
528
|
+
type: "group",
|
529
|
+
groupName: "group",
|
530
|
+
nodes: [],
|
531
|
+
steps: [
|
532
|
+
{
|
533
|
+
id: "0",
|
534
|
+
type: "single",
|
535
|
+
nodes: [
|
536
|
+
"A",
|
537
|
+
"B"
|
538
|
+
],
|
539
|
+
steps: [],
|
540
|
+
description: "AB",
|
541
|
+
note: ""
|
542
|
+
},
|
543
|
+
{
|
544
|
+
id: "g1",
|
545
|
+
type: "group",
|
546
|
+
groupName: "loop",
|
547
|
+
nodes: [],
|
548
|
+
steps: [
|
549
|
+
{
|
550
|
+
id: "1",
|
551
|
+
type: "single",
|
552
|
+
nodes: [
|
553
|
+
"B",
|
554
|
+
"C"
|
555
|
+
],
|
556
|
+
steps: [],
|
557
|
+
description: "BC",
|
558
|
+
note: ""
|
559
|
+
}
|
560
|
+
],
|
561
|
+
description: "testloop2",
|
562
|
+
note: "loop note testloop2"
|
563
|
+
}
|
564
|
+
],
|
565
|
+
description: "testgroup1",
|
566
|
+
note: "group note testgroup1"
|
567
|
+
}
|
568
|
+
];
|
569
|
+
|
570
|
+
const contents = require("./testfiles/steps_group_mixed.adoc").split("\n");
|
571
|
+
const data = parser.parseContents(contents);
|
572
|
+
|
573
|
+
expect(data.stepData).toEqual(expectedSteps);
|
574
|
+
});
|
575
|
+
|
576
|
+
/*
|
577
|
+
THE NOTES FEATURE
|
578
|
+
*/
|
579
|
+
it("should support single line notes", () => {
|
580
|
+
const expectedSteps = [
|
581
|
+
{
|
582
|
+
id: "0",
|
583
|
+
type: "single",
|
584
|
+
nodes: ["A", "B"],
|
585
|
+
steps: [],
|
586
|
+
description: "AB",
|
587
|
+
note: "AB note"
|
588
|
+
},
|
589
|
+
{
|
590
|
+
id: "1",
|
591
|
+
type: "single",
|
592
|
+
nodes: ["A", "C"],
|
593
|
+
steps: [],
|
594
|
+
description: "AC",
|
595
|
+
note: "AC note"
|
596
|
+
},
|
597
|
+
];
|
598
|
+
|
599
|
+
const contents = require("./testfiles/notes_singleline.adoc").split("\n");
|
600
|
+
const data = parser.parseContents(contents);
|
601
|
+
|
602
|
+
expect(data.stepData).toEqual(expectedSteps);
|
603
|
+
});
|
604
|
+
|
605
|
+
it("should support multiline notes", () => {
|
606
|
+
const expectedSteps = [
|
607
|
+
{
|
608
|
+
id: "0",
|
609
|
+
type: "single",
|
610
|
+
nodes: ["A", "B"],
|
611
|
+
steps: [],
|
612
|
+
description: "AB",
|
613
|
+
note: "AB note"
|
614
|
+
},
|
615
|
+
{
|
616
|
+
id: "1",
|
617
|
+
type: "single",
|
618
|
+
nodes: ["A", "C"],
|
619
|
+
steps: [],
|
620
|
+
description: "AC",
|
621
|
+
note: "AC line 1\n\nAC line 2"
|
622
|
+
},
|
623
|
+
];
|
624
|
+
|
625
|
+
const contents = require("./testfiles/notes_multiline.adoc").split("\n");
|
626
|
+
const data = parser.parseContents(contents);
|
627
|
+
|
628
|
+
expect(data.stepData).toEqual(expectedSteps);
|
629
|
+
});
|
630
|
+
|
631
|
+
/*
|
632
|
+
THE DIVIDERS FEATURE
|
633
|
+
*/
|
634
|
+
it("should support dividers and treat them like groups", () => {
|
635
|
+
|
636
|
+
const expectedSteps = [
|
637
|
+
{
|
638
|
+
id: 'g0',
|
639
|
+
type: 'group',
|
640
|
+
groupName: 'group',
|
641
|
+
nodes: [],
|
642
|
+
steps: [
|
643
|
+
{
|
644
|
+
id: '0',
|
645
|
+
type: 'single',
|
646
|
+
nodes: ["A", "B"],
|
647
|
+
steps: [],
|
648
|
+
description: "AB",
|
649
|
+
note: ""
|
650
|
+
},
|
651
|
+
{
|
652
|
+
id: '1',
|
653
|
+
type: 'single',
|
654
|
+
nodes: ["A", "C"],
|
655
|
+
steps: [],
|
656
|
+
description: "AC",
|
657
|
+
note: ""
|
658
|
+
}
|
659
|
+
],
|
660
|
+
description: 'As only',
|
661
|
+
note: ''
|
662
|
+
},
|
663
|
+
{
|
664
|
+
id: 'g1',
|
665
|
+
type: "group",
|
666
|
+
groupName: 'group',
|
667
|
+
nodes: [],
|
668
|
+
steps: [
|
669
|
+
{
|
670
|
+
id: '2',
|
671
|
+
type: 'single',
|
672
|
+
nodes: ["B", "A"],
|
673
|
+
steps: [],
|
674
|
+
description: "BA",
|
675
|
+
note: ""
|
676
|
+
},
|
677
|
+
{
|
678
|
+
id: '3',
|
679
|
+
type: 'single',
|
680
|
+
nodes: ["B", "C"],
|
681
|
+
steps: [],
|
682
|
+
description: "BC",
|
683
|
+
note: ""
|
684
|
+
}
|
685
|
+
],
|
686
|
+
description: 'Bs only',
|
687
|
+
note: ''
|
688
|
+
},
|
689
|
+
{
|
690
|
+
id: 'g2',
|
691
|
+
type: "group",
|
692
|
+
groupName: 'group',
|
693
|
+
nodes: [],
|
694
|
+
steps: [
|
695
|
+
{
|
696
|
+
id: '4',
|
697
|
+
type: 'single',
|
698
|
+
nodes: ["C", "A"],
|
699
|
+
steps: [],
|
700
|
+
description: "CA",
|
701
|
+
note: ""
|
702
|
+
},
|
703
|
+
{
|
704
|
+
id: '5',
|
705
|
+
type: 'single',
|
706
|
+
nodes: ["C", "B"],
|
707
|
+
steps: [],
|
708
|
+
description: "CB",
|
709
|
+
note: ""
|
710
|
+
}
|
711
|
+
],
|
712
|
+
description: 'Cs only',
|
713
|
+
note: ''
|
714
|
+
},
|
715
|
+
];
|
716
|
+
|
717
|
+
const contents = require("./testfiles/dividers.adoc").split("\n");
|
718
|
+
const data = parser.parseContents(contents);
|
719
|
+
|
720
|
+
expect(data.stepData).toEqual(expectedSteps);
|
721
|
+
// console.log(data.stepData[0]);
|
722
|
+
});
|
723
|
+
|
724
|
+
/*
|
725
|
+
THE PARTICIPANT INFO FEATURE
|
726
|
+
*/
|
727
|
+
it("should add an info property on a node if a note is created for the participant", () => {
|
728
|
+
const contents = require("./testfiles/participant_info.adoc").split("\n");
|
729
|
+
const data = parser.parseContents(contents);
|
730
|
+
|
731
|
+
const expectedNode = {
|
732
|
+
data: {
|
733
|
+
id: "A",
|
734
|
+
fname: "A",
|
735
|
+
zone: "#FBDCD6",
|
736
|
+
info: "this is some info on A<br/> newlines idk"
|
737
|
+
}
|
738
|
+
}
|
739
|
+
|
740
|
+
expect(data.graphData.nodes).toContainEqual(expectedNode);
|
741
|
+
})
|
742
|
+
|
743
|
+
|
744
|
+
/*
|
745
|
+
ONE-OFF TESTS
|
746
|
+
*/
|
747
|
+
|
748
|
+
// supporting this case because plantUML behaves the same way
|
749
|
+
it("should generate a participant if one isn't declared", () => {
|
750
|
+
const contents = require("./testfiles/undeclaredparticipant.adoc").split("\n");
|
751
|
+
const data = parser.parseContents(contents);
|
752
|
+
|
753
|
+
expect(data.graphData.nodes).toContainEqual({
|
754
|
+
data: {
|
755
|
+
id: 'TSYS',
|
756
|
+
fname: 'TSYS',
|
757
|
+
zone: '#FBDCD6'
|
758
|
+
}
|
759
|
+
});
|
760
|
+
})
|
761
|
+
|
762
|
+
it("should allow the same name in quotes per participant", () => {
|
763
|
+
const contents = require("./testfiles/doubled_names.adoc").split("\n");
|
764
|
+
const data = parser.parseContents(contents);
|
765
|
+
|
766
|
+
const expectedEdges = [
|
767
|
+
{
|
768
|
+
data: {
|
769
|
+
id: 'e0',
|
770
|
+
source: 'A',
|
771
|
+
target: 'B'
|
772
|
+
}
|
773
|
+
},
|
774
|
+
{
|
775
|
+
data: {
|
776
|
+
id: 'e1',
|
777
|
+
source: 'A',
|
778
|
+
target: 'C'
|
779
|
+
}
|
780
|
+
}
|
781
|
+
]
|
782
|
+
|
783
|
+
expect(data.graphData.edges).toEqual(expectedEdges);
|
784
|
+
})
|
785
|
+
|
786
|
+
it("should generate supernodes in a sane way", () => {
|
787
|
+
const contents = require("./testfiles/supernodes.adoc").split("\n");
|
788
|
+
const data = parser.parseContents(contents);
|
789
|
+
|
790
|
+
const expectedZone = {
|
791
|
+
data: {
|
792
|
+
id: "blue!",
|
793
|
+
zone: "#93d4ff"
|
794
|
+
}
|
795
|
+
}
|
796
|
+
|
797
|
+
expect(data.graphData.nodes).toContainEqual(expectedZone);
|
798
|
+
})
|
799
|
+
});
|