Skip to content

Commit bbde3d6

Browse files
committed
checkpoint
1 parent 943f9d5 commit bbde3d6

5 files changed

Lines changed: 537 additions & 110 deletions

File tree

client/ts/src/schematic/schematic.spec.ts

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ describe("Schematic", () => {
8080
expect(res.authority).toEqual(5);
8181
expect(res.nodes).toHaveLength(1);
8282
expect(res.nodes[0].key).toEqual("n1");
83-
expect((res.props.n1 as Record<string, unknown>).variant).toEqual("valve");
83+
expect(res.props.n1.variant).toEqual("valve");
8484
});
8585
});
8686

@@ -119,19 +119,13 @@ describe("Schematic", () => {
119119
},
120120
});
121121
const retrieved = await client.schematics.retrieve({ key: schem.key });
122-
const props = retrieved.props.n1 as Record<string, unknown>;
122+
const props = retrieved.props.n1;
123123
expect(props.camelCaseKey).toEqual("value1");
124124
expect(props.PascalCaseKey).toEqual("value2");
125125
expect(props.snake_case_key).toEqual("value3");
126-
expect((props.nested as Record<string, unknown>).innerCamelCase).toEqual(123);
127-
expect(
128-
(
129-
(props.nested as Record<string, unknown>).InnerPascalCase as Record<
130-
string,
131-
unknown
132-
>
133-
).deepKey,
134-
).toEqual(true);
126+
const nested = props.nested as Record<string, unknown>;
127+
expect(nested.innerCamelCase).toEqual(123);
128+
expect((nested.InnerPascalCase as Record<string, unknown>).deepKey).toEqual(true);
135129
});
136130
});
137131

@@ -205,7 +199,7 @@ describe("Schematic", () => {
205199
const res = await client.schematics.retrieve({ key: schem.key });
206200
expect(res.nodes).toHaveLength(1);
207201
expect(res.nodes[0]).toMatchObject({ key: "n1", position: { x: 1, y: 2 } });
208-
expect((res.props.n1 as Record<string, unknown>).label).toBe("Pump");
202+
expect(res.props.n1.label).toBe("Pump");
209203
});
210204

211205
test("removeNode removes the node and drops its props", async () => {
@@ -282,7 +276,7 @@ describe("Schematic", () => {
282276
schematic.setProps({ key: "n1", props: { label: "Replaced" } }),
283277
]);
284278
const res = await client.schematics.retrieve({ key: schem.key });
285-
expect((res.props.n1 as Record<string, unknown>).label).toBe("Replaced");
279+
expect(res.props.n1.label).toBe("Replaced");
286280
});
287281

288282
test("setAuthority replaces the authority value", async () => {
@@ -327,7 +321,7 @@ describe("Schematic", () => {
327321
expect(res.nodes).toHaveLength(2);
328322
expect(res.edges).toHaveLength(1);
329323
expect(res.authority).toBe(200);
330-
expect((res.props.pump as Record<string, unknown>).label).toBe("Main Pump");
324+
expect(res.props.pump.label).toBe("Main Pump");
331325
});
332326

333327
test("converges to the final position after a 30-action drag storm", async () => {
@@ -380,7 +374,7 @@ describe("Schematic", () => {
380374
}),
381375
]);
382376
const res = await client.schematics.retrieve({ key: schem.key });
383-
const props = res.props.n1 as Record<string, unknown>;
377+
const props = res.props.n1;
384378
expect(props.camelCaseKey).toBe("v1");
385379
expect(props.PascalCaseKey).toBe("v2");
386380
expect(props.snake_case_key).toBe("v3");

core/pkg/service/schematic/migrations/testdata/v2_gse_condensed.migrated.json

Lines changed: 114 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,7 +1635,12 @@
16351635
"variant": "value"
16361636
},
16371637
"Czhkq14bwKL": {
1638-
"color": [171, 0, 255, 1],
1638+
"color": [
1639+
171,
1640+
0,
1641+
255,
1642+
1
1643+
],
16391644
"label": {
16401645
"align": "center",
16411646
"label": "To Engine",
@@ -1657,7 +1662,12 @@
16571662
"variant": "pipe"
16581663
},
16591664
"DeV37ebNkgE": {
1660-
"backgroundColor": [10, 10, 10, 0],
1665+
"backgroundColor": [
1666+
10,
1667+
10,
1668+
10,
1669+
0
1670+
],
16611671
"borderRadius": 0,
16621672
"color": "#d20000",
16631673
"dimensions": {
@@ -2083,7 +2093,12 @@
20832093
"variant": "solenoidValve"
20842094
},
20852095
"JjPiK1XPeF6": {
2086-
"backgroundColor": [10, 10, 10, 0],
2096+
"backgroundColor": [
2097+
10,
2098+
10,
2099+
10,
2100+
0
2101+
],
20872102
"borderRadius": {
20882103
"x": 50,
20892104
"y": 10
@@ -2295,7 +2310,12 @@
22952310
"variant": "pipe"
22962311
},
22972312
"OABTFTzErmB": {
2298-
"backgroundColor": [10, 10, 10, 0],
2313+
"backgroundColor": [
2314+
10,
2315+
10,
2316+
10,
2317+
0
2318+
],
22992319
"borderRadius": {
23002320
"x": 50,
23012321
"y": 10
@@ -2317,7 +2337,12 @@
23172337
"variant": "tank"
23182338
},
23192339
"OOkLb5RngOz": {
2320-
"color": [0, 121, 255, 1],
2340+
"color": [
2341+
0,
2342+
121,
2343+
255,
2344+
1
2345+
],
23212346
"label": {
23222347
"align": "center",
23232348
"label": "To OX",
@@ -2505,7 +2530,12 @@
25052530
"variant": "orifice"
25062531
},
25072532
"QWGklzcRmcV": {
2508-
"color": [210, 0, 0, 1],
2533+
"color": [
2534+
210,
2535+
0,
2536+
0,
2537+
1
2538+
],
25092539
"label": {
25102540
"align": "center",
25112541
"label": "To FUEL",
@@ -2931,7 +2961,12 @@
29312961
"variant": "staticMixer"
29322962
},
29332963
"UOdnd6Aha36": {
2934-
"color": [0, 152, 39, 1],
2964+
"color": [
2965+
0,
2966+
152,
2967+
39,
2968+
1
2969+
],
29352970
"label": {
29362971
"align": "center",
29372972
"label": "From Press",
@@ -3036,7 +3071,12 @@
30363071
"variant": "value"
30373072
},
30383073
"XajoNRDoFqn": {
3039-
"color": [0, 176, 255, 1],
3074+
"color": [
3075+
0,
3076+
176,
3077+
255,
3078+
1
3079+
],
30403080
"inlineSize": 70,
30413081
"label": {
30423082
"align": "center",
@@ -3147,9 +3187,19 @@
31473187
"variant": "pipe"
31483188
},
31493189
"bvLG286CeYr": {
3150-
"backgroundColor": [10, 10, 10, 0],
3190+
"backgroundColor": [
3191+
10,
3192+
10,
3193+
10,
3194+
0
3195+
],
31513196
"borderRadius": 3,
3152-
"color": [210, 0, 0, 1],
3197+
"color": [
3198+
210,
3199+
0,
3200+
0,
3201+
1
3202+
],
31533203
"dimensions": {
31543204
"height": 38,
31553205
"width": 108
@@ -3213,7 +3263,12 @@
32133263
"variant": "pipe"
32143264
},
32153265
"fNn6627SLuM": {
3216-
"backgroundColor": [10, 10, 10, 0],
3266+
"backgroundColor": [
3267+
10,
3268+
10,
3269+
10,
3270+
0
3271+
],
32173272
"borderRadius": 0,
32183273
"color": "#00b0ff",
32193274
"dimensions": {
@@ -3327,7 +3382,12 @@
33273382
"variant": "solenoidValve"
33283383
},
33293384
"i3O5NYaw7U8": {
3330-
"color": [0, 152, 39, 1],
3385+
"color": [
3386+
0,
3387+
152,
3388+
39,
3389+
1
3390+
],
33313391
"label": {
33323392
"align": "center",
33333393
"label": "From Press",
@@ -3409,7 +3469,12 @@
34093469
"variant": "pipe"
34103470
},
34113471
"kzoCoaFsLXm": {
3412-
"backgroundColor": [10, 10, 10, 0],
3472+
"backgroundColor": [
3473+
10,
3474+
10,
3475+
10,
3476+
0
3477+
],
34133478
"borderRadius": 3,
34143479
"color": "#00b0ff",
34153480
"dimensions": {
@@ -3487,7 +3552,12 @@
34873552
"variant": "pipe"
34883553
},
34893554
"rPpCZ6MD5As": {
3490-
"color": [171, 0, 255, 1],
3555+
"color": [
3556+
171,
3557+
0,
3558+
255,
3559+
1
3560+
],
34913561
"label": {
34923562
"align": "center",
34933563
"label": "To Engine",
@@ -3760,7 +3830,12 @@
37603830
"variant": "pipe"
37613831
},
37623832
"s6dSeA0idmI": {
3763-
"backgroundColor": [10, 10, 10, 0],
3833+
"backgroundColor": [
3834+
10,
3835+
10,
3836+
10,
3837+
0
3838+
],
37643839
"borderRadius": {
37653840
"x": 50,
37663841
"y": 10
@@ -4014,7 +4089,12 @@
40144089
"variant": "value"
40154090
},
40164091
"uD0n1qxXf9L": {
4017-
"backgroundColor": [10, 10, 10, 0],
4092+
"backgroundColor": [
4093+
10,
4094+
10,
4095+
10,
4096+
0
4097+
],
40184098
"borderRadius": {
40194099
"x": 50,
40204100
"y": 10
@@ -4314,7 +4394,12 @@
43144394
"variant": "value"
43154395
},
43164396
"wqAUB77dleH": {
4317-
"backgroundColor": [10, 10, 10, 0],
4397+
"backgroundColor": [
4398+
10,
4399+
10,
4400+
10,
4401+
0
4402+
],
43184403
"borderRadius": {
43194404
"x": 50,
43204405
"y": 10
@@ -4346,7 +4431,12 @@
43464431
"variant": "pipe"
43474432
},
43484433
"zPngCTpi3wa": {
4349-
"backgroundColor": [10, 10, 10, 0],
4434+
"backgroundColor": [
4435+
10,
4436+
10,
4437+
10,
4438+
0
4439+
],
43504440
"borderRadius": 3,
43514441
"color": "#d20000",
43524442
"dimensions": {
@@ -4365,7 +4455,12 @@
43654455
"variant": "box"
43664456
},
43674457
"zv17pHUEYJq": {
4368-
"backgroundColor": [10, 10, 10, 0],
4458+
"backgroundColor": [
4459+
10,
4460+
10,
4461+
10,
4462+
0
4463+
],
43694464
"borderRadius": {
43704465
"x": 50,
43714466
"y": 10

0 commit comments

Comments
 (0)