-
-
Notifications
You must be signed in to change notification settings - Fork 6k
/
contextMap.spec.ts
116 lines (115 loc) · 3.97 KB
/
contextMap.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import { describe, test, expect } from 'vitest';
import type { Link, RawLink } from './contextMap.js';
import { mapEdgeLabels } from './contextMap.js';
describe('graph construction', () => {
test.each([
{
rawLink: {
source: { id: 'CargoBookingContext', type: ['SK'] },
target: {
id: 'VoyagePlanningContextVoyagePlanningContextVoyagePlanningContext',
type: ['SK'],
},
arrow: ['left', 'right'],
},
link: {
source: { id: 'CargoBookingContext', boxText: undefined, bodyText: undefined },
target: {
id: 'VoyagePlanningContextVoyagePlanningContextVoyagePlanningContext',
boxText: undefined,
bodyText: undefined,
},
middleText: 'Shared Kernel',
},
},
{
rawLink: {
source: { id: 'CustomerSelfServiceContext', type: ['D', 'C'] },
target: { id: 'CustomerManagementContext', type: ['U', 'S'] },
arrow: ['right'],
},
link: {
source: { id: 'CustomerSelfServiceContext', boxText: 'D', bodyText: undefined },
target: { id: 'CustomerManagementContext', boxText: 'U', bodyText: undefined },
middleText: 'Customer/Supplier',
},
},
{
rawLink: {
source: { id: 'CustomerManagementContext', type: ['D', 'ACL'] },
target: { id: 'PrintingContext', type: ['U', 'OHS', 'PL'] },
arrow: ['right'],
},
link: {
source: { id: 'CustomerManagementContext', boxText: 'D', bodyText: 'ACL' },
target: { id: 'PrintingContext', boxText: 'U', bodyText: 'OHS, PL' },
middleText: undefined,
},
},
{
rawLink: {
source: { id: 'PrintingContext', type: ['U', 'OHS', 'PL'] },
target: { id: 'PolicyManagementContext', type: ['D', 'ACL'] },
arrow: ['right'],
},
link: {
source: { id: 'PrintingContext', boxText: 'U', bodyText: 'OHS, PL' },
target: { id: 'PolicyManagementContext', boxText: 'D', bodyText: 'ACL' },
middleText: undefined,
},
},
{
rawLink: {
source: { id: 'RiskManagementContext', type: ['P'] },
target: { id: 'PolicyManagementContext', type: ['P'] },
arrow: ['left', 'right'],
},
link: {
source: { id: 'RiskManagementContext', boxText: undefined, bodyText: undefined },
target: { id: 'PolicyManagementContext', boxText: undefined, bodyText: undefined },
middleText: 'Partnership',
},
},
{
rawLink: {
source: { id: 'PolicyManagementContext', type: ['D', 'CF'] },
target: { id: 'CustomerManagementContext', type: ['U', 'OHS', 'PL'] },
arrow: ['right'],
},
link: {
source: { id: 'PolicyManagementContext', boxText: 'D', bodyText: 'CF' },
target: { id: 'CustomerManagementContext', boxText: 'U', bodyText: 'OHS, PL' },
middleText: undefined,
},
},
{
rawLink: {
source: { id: 'DebtCollection', type: ['D', 'ACL'] },
target: { id: 'PrintingContext', type: ['U', 'OHS', 'PL'] },
arrow: ['right'],
},
link: {
source: { id: 'DebtCollection', boxText: 'D', bodyText: 'ACL' },
target: { id: 'PrintingContext', boxText: 'U', bodyText: 'OHS, PL' },
middleText: undefined,
},
},
{
rawLink: {
source: { id: 'CustomersBackofficeTeam', type: ['U', 'S'] },
target: { id: 'CustomersFrontofficeTeam', type: ['D', 'C'] },
arrow: ['right'],
},
link: {
source: { id: 'CustomersBackofficeTeam', boxText: 'U', bodyText: undefined },
target: { id: 'CustomersFrontofficeTeam', boxText: 'D', bodyText: undefined },
middleText: 'Customer/Supplier',
},
},
] as { rawLink: RawLink; link: Link }[])(
'map labels for source: $rawLink.source.type, and target: $rawLink.target.type',
({ rawLink, link }: { rawLink: RawLink; link: Link }) => {
expect(mapEdgeLabels(rawLink)).toStrictEqual(link);
}
);
});