@@ -17,7 +17,10 @@ import {
17
17
selectRelationship ,
18
18
} from '../store/diagram' ;
19
19
import dataModel from '../../test/fixtures/data-model-with-relationships.json' ;
20
- import type { MongoDBDataModelDescription } from '../services/data-model-storage' ;
20
+ import type {
21
+ MongoDBDataModelDescription ,
22
+ Relationship ,
23
+ } from '../services/data-model-storage' ;
21
24
22
25
async function comboboxSelectItem (
23
26
label : string ,
@@ -67,7 +70,37 @@ describe('DiagramEditorSidePanel', function () {
67
70
result . plugin . store . dispatch (
68
71
selectRelationship ( '204b1fc0-601f-4d62-bba3-38fade71e049' )
69
72
) ;
70
- expect ( screen . getByText ( 'Edit Relationship' ) ) . to . be . visible ;
73
+
74
+ const name = screen . getByLabelText ( 'Name' ) ;
75
+ expect ( name ) . to . be . visible ;
76
+ expect ( name ) . to . have . value ( 'Airport Country' ) ;
77
+
78
+ const localCollectionInput = screen . getByLabelText ( 'Local collection' ) ;
79
+ expect ( localCollectionInput ) . to . be . visible ;
80
+ expect ( localCollectionInput ) . to . have . value ( 'countries' ) ;
81
+
82
+ const foreignCollectionInput = screen . getByLabelText ( 'Foreign collection' ) ;
83
+ expect ( foreignCollectionInput ) . to . be . visible ;
84
+ expect ( foreignCollectionInput ) . to . have . value ( 'airports' ) ;
85
+
86
+ const localFieldInput = screen . getByLabelText ( 'Local field' ) ;
87
+ expect ( localFieldInput ) . to . be . visible ;
88
+ expect ( localFieldInput ) . to . have . value ( 'name' ) ;
89
+
90
+ const foreignFieldInput = screen . getByLabelText ( 'Foreign field' ) ;
91
+ expect ( foreignFieldInput ) . to . be . visible ;
92
+ expect ( foreignFieldInput ) . to . have . value ( 'Country' ) ;
93
+
94
+ const localCardinalityInput = screen . getByLabelText ( 'Local cardinality' ) ;
95
+ expect ( localCardinalityInput ) . to . be . visible ;
96
+ expect ( localCardinalityInput ) . to . have . value ( '1' ) ;
97
+
98
+ const foreignCardinalityInput = screen . getByLabelText (
99
+ 'Foreign cardinality'
100
+ ) ;
101
+ expect ( foreignCardinalityInput ) . to . be . visible ;
102
+ expect ( foreignCardinalityInput ) . to . have . value ( '100' ) ;
103
+
71
104
expect (
72
105
document . querySelector (
73
106
'[data-relationship-id="204b1fc0-601f-4d62-bba3-38fade71e049"]'
@@ -120,7 +153,7 @@ describe('DiagramEditorSidePanel', function () {
120
153
userEvent . click (
121
154
within ( relationshipCard ! ) . getByRole ( 'button' , { name : 'Edit' } )
122
155
) ;
123
- expect ( screen . getByText ( 'Edit Relationship ') ) . to . be . visible ;
156
+ expect ( screen . getByLabelText ( 'Local field ') ) . to . be . visible ;
124
157
125
158
// Select new values
126
159
await comboboxSelectItem ( 'Local collection' , 'planes' ) ;
@@ -133,7 +166,7 @@ describe('DiagramEditorSidePanel', function () {
133
166
// model here
134
167
const modifiedRelationship = selectCurrentModel (
135
168
getCurrentDiagramFromState ( result . plugin . store . getState ( ) ) . edits
136
- ) . relationships . find ( ( r ) => {
169
+ ) . relationships . find ( ( r : Relationship ) => {
137
170
return r . id === '204b1fc0-601f-4d62-bba3-38fade71e049' ;
138
171
} ) ;
139
172
@@ -148,7 +181,7 @@ describe('DiagramEditorSidePanel', function () {
148
181
{
149
182
ns : 'flights.countries' ,
150
183
fields : [ 'iso_code' ] ,
151
- cardinality : 1 ,
184
+ cardinality : 100 ,
152
185
} ,
153
186
] ) ;
154
187
} ) ;
0 commit comments