Skip to content

Commit 7bc8a93

Browse files
committed
chore(data-modeling): add more tests
1 parent fad816b commit 7bc8a93

File tree

2 files changed

+40
-243
lines changed

2 files changed

+40
-243
lines changed

packages/compass-data-modeling/src/components/diagram-editor-side-panel.spec.tsx

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,28 +56,62 @@ describe('DiagramEditorSidePanel', function () {
5656
expect(screen.queryByTestId('data-modeling-drawer')).to.eq(null);
5757
});
5858

59-
it('should render a collection context drawer when collection is clicked', async function () {
59+
it('should render a collection context drawer when collection is clicked', function () {
6060
const result = renderDrawer();
61-
await result.plugin.store.dispatch(selectCollection('flights.airlines'));
61+
result.plugin.store.dispatch(selectCollection('flights.airlines'));
6262
expect(screen.getByText('flights.airlines')).to.be.visible;
6363
});
6464

65-
it('should render a relationship context drawer when relations is clicked', async function () {
65+
it('should render a relationship context drawer when relations is clicked', function () {
6666
const result = renderDrawer();
67-
await result.plugin.store.dispatch(
67+
result.plugin.store.dispatch(
6868
selectRelationship('204b1fc0-601f-4d62-bba3-38fade71e049')
6969
);
7070
expect(screen.getByText('Edit Relationship')).to.be.visible;
7171
expect(
7272
document.querySelector(
7373
'[data-relationship-id="204b1fc0-601f-4d62-bba3-38fade71e049"]'
7474
)
75-
).to.exist;
75+
).to.be.visible;
76+
});
77+
78+
it('should change the content of the drawer when selecting different items', function () {
79+
const result = renderDrawer();
80+
81+
result.plugin.store.dispatch(selectCollection('flights.airlines'));
82+
expect(screen.getByText('flights.airlines')).to.be.visible;
83+
84+
result.plugin.store.dispatch(
85+
selectCollection('flights.airports_coordinates_for_schema')
86+
);
87+
expect(screen.getByText('flights.airports_coordinates_for_schema')).to.be
88+
.visible;
89+
90+
result.plugin.store.dispatch(
91+
selectRelationship('204b1fc0-601f-4d62-bba3-38fade71e049')
92+
);
93+
expect(
94+
document.querySelector(
95+
'[data-relationship-id="204b1fc0-601f-4d62-bba3-38fade71e049"]'
96+
)
97+
).to.be.visible;
98+
99+
result.plugin.store.dispatch(
100+
selectRelationship('6f776467-4c98-476b-9b71-1f8a724e6c2c')
101+
);
102+
expect(
103+
document.querySelector(
104+
'[data-relationship-id="6f776467-4c98-476b-9b71-1f8a724e6c2c"]'
105+
)
106+
).to.be.visible;
107+
108+
result.plugin.store.dispatch(selectCollection('flights.planes'));
109+
expect(screen.getByText('flights.planes')).to.be.visible;
76110
});
77111

78112
it('should open and edit relationship starting from collection', async function () {
79113
const result = renderDrawer();
80-
await result.plugin.store.dispatch(selectCollection('flights.countries'));
114+
result.plugin.store.dispatch(selectCollection('flights.countries'));
81115

82116
// Open relationshipt editing form
83117
const relationshipCard = document.querySelector<HTMLElement>(

packages/compass-data-modeling/test/fixtures/data-model-with-relationships.json

Lines changed: 0 additions & 237 deletions
Original file line numberDiff line numberDiff line change
@@ -276,202 +276,6 @@
276276
"isInferred": false
277277
}
278278
},
279-
{
280-
"id": "270bc8a9-566e-4387-9d84-d0b777822947",
281-
"timestamp": "2025-07-11T11:01:26.318Z",
282-
"type": "MoveCollection",
283-
"ns": "flights.countries",
284-
"newPosition": [219.40735570787513, 979.18365450302]
285-
},
286-
{
287-
"id": "437cf39d-5db7-4508-96bf-cfa581e7586f",
288-
"timestamp": "2025-07-14T13:17:30.228Z",
289-
"type": "MoveCollection",
290-
"ns": "flights.planes",
291-
"newPosition": [609.3925977542651, 567.3885505528234]
292-
},
293-
{
294-
"id": "eee357c2-8e7f-4bdc-97bf-92452fc929b6",
295-
"timestamp": "2025-07-14T13:17:32.356Z",
296-
"type": "MoveCollection",
297-
"ns": "flights.airports",
298-
"newPosition": [-90.61474783348534, 489.6768071064075]
299-
},
300-
{
301-
"id": "6dd87643-34cc-4316-a0c7-239afb14cf29",
302-
"timestamp": "2025-07-14T13:53:04.812Z",
303-
"type": "MoveCollection",
304-
"ns": "flights.airports",
305-
"newPosition": [-198.6464279915867, 552.4048794562729]
306-
},
307-
{
308-
"id": "aed7de69-d6da-4cd6-9cfa-ad168c3bbbd2",
309-
"timestamp": "2025-07-14T13:53:06.155Z",
310-
"type": "MoveCollection",
311-
"ns": "flights.planes",
312-
"newPosition": [743.5609747248104, 692.8446952525541]
313-
},
314-
{
315-
"id": "edb81252-00c6-4246-b386-5dc57ab5d77e",
316-
"timestamp": "2025-07-14T13:53:07.541Z",
317-
"type": "MoveCollection",
318-
"ns": "flights.countries",
319-
"newPosition": [409.334019211634, 564.4813984122438]
320-
},
321-
{
322-
"id": "5c216650-4f94-4bc0-a86f-d6998f955ba7",
323-
"timestamp": "2025-07-14T13:53:11.383Z",
324-
"type": "MoveCollection",
325-
"ns": "flights.airports_coordinates_for_schema",
326-
"newPosition": [552.1160786088143, 229.65583041119885]
327-
},
328-
{
329-
"id": "2fc01a1c-9a77-4d04-88a2-75ae1e723d4b",
330-
"timestamp": "2025-07-14T13:53:12.608Z",
331-
"type": "MoveCollection",
332-
"ns": "flights.routes",
333-
"newPosition": [851.6053350549475, 360.1288043921029]
334-
},
335-
{
336-
"id": "5a0a17c5-5a1d-403d-9376-4592ac178553",
337-
"timestamp": "2025-07-14T13:53:14.813Z",
338-
"type": "MoveCollection",
339-
"ns": "flights.planes",
340-
"newPosition": [121.50759058864625, 973.378574372785]
341-
},
342-
{
343-
"id": "d32b091a-5f88-49df-a3ee-df2879b6c6ac",
344-
"timestamp": "2025-07-14T13:53:17.755Z",
345-
"type": "MoveCollection",
346-
"ns": "flights.countries",
347-
"newPosition": [658.5038621569322, 824.1059200825196]
348-
},
349-
{
350-
"id": "0a36d07f-d787-4901-9415-446b33d598db",
351-
"timestamp": "2025-07-14T13:53:18.858Z",
352-
"type": "MoveCollection",
353-
"ns": "flights.planes",
354-
"newPosition": [121.50759058864625, 856.634661943869]
355-
},
356-
{
357-
"id": "9d34b954-7636-4ae7-b26d-3f6b30727bdf",
358-
"timestamp": "2025-07-14T13:53:55.706Z",
359-
"type": "MoveCollection",
360-
"ns": "flights.airports_coordinates_for_schema",
361-
"newPosition": [387.78686853696104, 186.3442556635786]
362-
},
363-
{
364-
"id": "66e5b3fc-9464-479d-956e-d55ca7ba36ce",
365-
"timestamp": "2025-07-14T13:53:57.156Z",
366-
"type": "MoveCollection",
367-
"ns": "flights.airports_coordinates_for_schema",
368-
"newPosition": [743.1965554365506, 102.26884585937458]
369-
},
370-
{
371-
"id": "58e90723-a7d5-4e12-8b2a-52168e191344",
372-
"timestamp": "2025-07-14T13:54:09.420Z",
373-
"type": "MoveCollection",
374-
"ns": "flights.airlines",
375-
"newPosition": [166.97481820374284, 161.81444130145675]
376-
},
377-
{
378-
"id": "83287bca-cf13-4085-9c23-9cb72cd6f877",
379-
"timestamp": "2025-07-14T13:54:10.721Z",
380-
"type": "MoveCollection",
381-
"ns": "flights.airlines",
382-
"newPosition": [56.14814164365578, 159.26670161042026]
383-
},
384-
{
385-
"id": "c7b64382-0b61-47cb-9981-0adad1606093",
386-
"timestamp": "2025-07-14T14:01:59.729Z",
387-
"type": "MoveCollection",
388-
"ns": "flights.routes",
389-
"newPosition": [905.6167270451696, 486.15538570262083]
390-
},
391-
{
392-
"id": "362774a3-d083-4cd0-b8e7-4f72b677d586",
393-
"timestamp": "2025-07-14T14:02:01.057Z",
394-
"type": "MoveCollection",
395-
"ns": "flights.airlines",
396-
"newPosition": [432.59117672702115, 268.9261944390528]
397-
},
398-
{
399-
"id": "27193354-41ba-48aa-8b19-dd3aab6e0359",
400-
"timestamp": "2025-07-14T14:30:18.279Z",
401-
"type": "MoveCollection",
402-
"ns": "flights.airlines",
403-
"newPosition": [343.3983833938203, -610.880334566423]
404-
},
405-
{
406-
"id": "4959b8d0-78a5-426f-8365-39c0a4f2b345",
407-
"timestamp": "2025-07-15T12:18:22.918Z",
408-
"type": "MoveCollection",
409-
"ns": "flights.airlines",
410-
"newPosition": [242.92856982576654, 142.6432671939803]
411-
},
412-
{
413-
"id": "12f3c89c-fbe3-44c0-9039-bad4be6be371",
414-
"timestamp": "2025-07-15T12:18:29.799Z",
415-
"type": "MoveCollection",
416-
"ns": "flights.airports_coordinates_for_schema",
417-
"newPosition": [470.11241988358745, 436.5357658804881]
418-
},
419-
{
420-
"id": "7d8796a9-b6a4-45a4-b997-65ddfe946a70",
421-
"timestamp": "2025-07-15T12:18:35.463Z",
422-
"type": "MoveCollection",
423-
"ns": "flights.airlines",
424-
"newPosition": [198.16067875151032, 326.19162059843103]
425-
},
426-
{
427-
"id": "4bdaf312-3324-4f11-a2f6-b2bfb1a63345",
428-
"timestamp": "2025-07-15T12:18:38.206Z",
429-
"type": "MoveCollection",
430-
"ns": "flights.airports_coordinates_for_schema",
431-
"newPosition": [467.12789381197035, 430.5667137372539]
432-
},
433-
{
434-
"id": "bbdcda75-ed3a-45ea-9998-b1eb5d7cdaef",
435-
"timestamp": "2025-07-15T12:18:42.880Z",
436-
"type": "MoveCollection",
437-
"ns": "flights.routes",
438-
"newPosition": [374.37108629732853, 557.7840114214308]
439-
},
440-
{
441-
"id": "2366cf7b-ed7b-4a05-b37a-28bab3733dba",
442-
"timestamp": "2025-07-15T12:18:51.023Z",
443-
"type": "MoveCollection",
444-
"ns": "flights.airports_coordinates_for_schema",
445-
"newPosition": [467.12789381197035, 433.551239808871]
446-
},
447-
{
448-
"id": "d1c1b69d-33d0-45f0-8c47-84c6ea56a1ed",
449-
"timestamp": "2025-07-15T12:18:58.823Z",
450-
"type": "MoveCollection",
451-
"ns": "flights.routes",
452-
"newPosition": [765.3440016791667, 453.3255989148329]
453-
},
454-
{
455-
"id": "19342f14-64ea-4b0d-bf62-3e438f70f403",
456-
"timestamp": "2025-07-15T12:19:03.839Z",
457-
"type": "MoveCollection",
458-
"ns": "flights.countries",
459-
"newPosition": [455.5560892869704, 616.6813581051322]
460-
},
461-
{
462-
"id": "b280b29d-ccd3-4128-805c-2dd0a9e7f8b1",
463-
"timestamp": "2025-07-15T12:19:08.929Z",
464-
"type": "MoveCollection",
465-
"ns": "flights.airports",
466-
"newPosition": [144.57407024437805, 595.6805074947205]
467-
},
468-
{
469-
"id": "0d776d36-ef62-4afd-8a1e-281359b27718",
470-
"timestamp": "2025-07-15T12:19:11.206Z",
471-
"type": "MoveCollection",
472-
"ns": "flights.planes",
473-
"newPosition": [766.1652220579366, 291.0669713724315]
474-
},
475279
{
476280
"type": "UpdateRelationship",
477281
"relationship": {
@@ -492,47 +296,6 @@
492296
},
493297
"id": "6e06446c-3304-4a1d-a070-99ade7db2d4c",
494298
"timestamp": "2025-07-17T10:09:00.490Z"
495-
},
496-
{
497-
"type": "RemoveRelationship",
498-
"relationshipId": "6f776467-4c98-476b-9b71-1f8a724e6c2c",
499-
"id": "cf0aeeb2-78b3-40ab-abcc-886630504c2b",
500-
"timestamp": "2025-07-17T10:09:02.529Z"
501-
},
502-
{
503-
"type": "MoveCollection",
504-
"ns": "flights.airlines",
505-
"newPosition": [213.44223754771434, 317.4593012863144],
506-
"id": "c38befd6-61df-42f3-bdb9-429a6ebd00bf",
507-
"timestamp": "2025-07-17T11:30:51.454Z"
508-
},
509-
{
510-
"type": "MoveCollection",
511-
"ns": "flights.airlines",
512-
"newPosition": [177.42142038523338, 275.98078455376054],
513-
"id": "f53e8069-af2d-4b3d-aed1-ba3af4853ca5",
514-
"timestamp": "2025-07-17T11:30:52.271Z"
515-
},
516-
{
517-
"type": "MoveCollection",
518-
"ns": "flights.airports",
519-
"newPosition": [159.85562904058213, 530.1881126538459],
520-
"id": "dedfe068-cd9f-4d1c-8fd1-5cebb400693e",
521-
"timestamp": "2025-07-17T11:30:53.585Z"
522-
},
523-
{
524-
"type": "MoveCollection",
525-
"ns": "flights.airports",
526-
"newPosition": [167.49640843868417, 536.7373521379334],
527-
"id": "dec23099-2a01-4d59-8786-1a558970b68d",
528-
"timestamp": "2025-07-17T11:30:54.452Z"
529-
},
530-
{
531-
"type": "MoveCollection",
532-
"ns": "flights.airports",
533-
"newPosition": [167.49640843868417, 536.7373521379334],
534-
"id": "6e29e453-4ea8-435b-919f-8245a1abddd6",
535-
"timestamp": "2025-07-17T12:07:37.740Z"
536299
}
537300
],
538301
"createdAt": "2025-06-20T06:35:26.773Z",

0 commit comments

Comments
 (0)