File tree Expand file tree Collapse file tree 1 file changed +70
-0
lines changed
bulk-model-sync-lib/src/commonTest/kotlin/org/modelix/model/sync/bulk Expand file tree Collapse file tree 1 file changed +70
-0
lines changed Original file line number Diff line number Diff line change @@ -328,6 +328,76 @@ class ModelImporterTest {
328
328
assertEquals(expectedOperations, branch.getNumOfUsedOperationsByType())
329
329
}
330
330
331
+ @Test
332
+ @JsName(" can_handle_concept_changes" )
333
+ fun `can handle concept changes` () {
334
+ // language=json
335
+ val initialData = """
336
+ {
337
+ "root": {
338
+ "id": "node:001",
339
+ "children": [
340
+ {
341
+ "id": "node:002",
342
+ "concept": "ref:MyOldConcept",
343
+ "children": [
344
+ {
345
+ "id": "child02",
346
+ "references": {
347
+ "myReference": "node:003"
348
+ },
349
+ "properties": {
350
+ "myProperty": "myPropertyValue"
351
+ }
352
+ }
353
+ ]
354
+ },
355
+ {
356
+ "id": "node:003"
357
+ }
358
+ ]
359
+ }
360
+ }
361
+ """ .trimIndent().let { ModelData .fromJson(it) }
362
+
363
+ // language=json
364
+ val expectedData = """
365
+ {
366
+ "root": {
367
+ "id": "node:001",
368
+ "children": [
369
+ {
370
+ "id": "node:002",
371
+ "concept": "ref:MyNewConcept",
372
+ "children": [
373
+ {
374
+ "id": "child02",
375
+ "references": {
376
+ "myReference": "node:003"
377
+ },
378
+ "properties": {
379
+ "myProperty": "myPropertyValue"
380
+ }
381
+ }
382
+ ]
383
+ },
384
+ {
385
+ "id": "node:003"
386
+ }
387
+ ]
388
+ }
389
+ }
390
+ """ .trimIndent().let { ModelData .fromJson(it) }
391
+
392
+ val branch = createOTBranchFromModel(initialData)
393
+ branch.importIncrementally(expectedData)
394
+
395
+ branch.runRead {
396
+ val changedNode = branch.getRootNode().allChildren.first()
397
+ assertEquals(" ref:MyNewConcept" , changedNode.getConceptReference().toString())
398
+ }
399
+ }
400
+
331
401
@Test
332
402
@JsName(" can_import_complex_model" )
333
403
fun `can import complex model` () {
You can’t perform that action at this time.
0 commit comments