@api-client/core 0.11.11 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Testing.md +1 -1
- package/bin/plugins/events/EventPlugin.ts +61 -0
- package/bin/plugins/events/assert.ts +193 -0
- package/bin/plugins/events/types.ts +6 -0
- package/bin/test.ts +8 -1
- package/build/src/amf/AmfShapeGenerator.d.ts +6 -3
- package/build/src/amf/AmfShapeGenerator.d.ts.map +1 -1
- package/build/src/amf/AmfShapeGenerator.js +4 -1
- package/build/src/amf/AmfShapeGenerator.js.map +1 -1
- package/build/src/amf/AmfTypes.d.ts +2 -2
- package/build/src/amf/AmfTypes.d.ts.map +1 -1
- package/build/src/amf/AmfTypes.js.map +1 -1
- package/build/src/amf/DataValueGenerator.d.ts +15 -15
- package/build/src/amf/DataValueGenerator.d.ts.map +1 -1
- package/build/src/amf/DataValueGenerator.js +14 -14
- package/build/src/amf/DataValueGenerator.js.map +1 -1
- package/build/src/browser.d.ts +12 -9
- package/build/src/browser.d.ts.map +1 -1
- package/build/src/browser.js +11 -8
- package/build/src/browser.js.map +1 -1
- package/build/src/exceptions/attach_exception.d.ts +11 -0
- package/build/src/exceptions/attach_exception.d.ts.map +1 -0
- package/build/src/exceptions/attach_exception.js +11 -0
- package/build/src/exceptions/attach_exception.js.map +1 -0
- package/build/src/exceptions/detach_exception.d.ts +11 -0
- package/build/src/exceptions/detach_exception.d.ts.map +1 -0
- package/build/src/exceptions/detach_exception.js +11 -0
- package/build/src/exceptions/detach_exception.js.map +1 -0
- package/build/src/exceptions/remove_model_exception.d.ts +8 -0
- package/build/src/exceptions/remove_model_exception.d.ts.map +1 -0
- package/build/src/exceptions/remove_model_exception.js +8 -0
- package/build/src/exceptions/remove_model_exception.js.map +1 -0
- package/build/src/exceptions/remove_namespace_exception.d.ts +8 -0
- package/build/src/exceptions/remove_namespace_exception.d.ts.map +1 -0
- package/build/src/exceptions/remove_namespace_exception.js +8 -0
- package/build/src/exceptions/remove_namespace_exception.js.map +1 -0
- package/build/src/index.d.ts +12 -9
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +11 -8
- package/build/src/index.js.map +1 -1
- package/build/src/legacy.d.ts +8 -0
- package/build/src/legacy.d.ts.map +1 -1
- package/build/src/legacy.js +9 -0
- package/build/src/legacy.js.map +1 -1
- package/build/src/modeling/Bindings.d.ts +2 -2
- package/build/src/modeling/Bindings.d.ts.map +1 -1
- package/build/src/modeling/Bindings.js.map +1 -1
- package/build/src/modeling/DataDomain.d.ts +601 -0
- package/build/src/modeling/DataDomain.d.ts.map +1 -0
- package/build/src/modeling/DataDomain.js +1142 -0
- package/build/src/modeling/DataDomain.js.map +1 -0
- package/build/src/modeling/DataFormat.d.ts +42 -41
- package/build/src/modeling/DataFormat.d.ts.map +1 -1
- package/build/src/modeling/DataFormat.js +30 -131
- package/build/src/modeling/DataFormat.js.map +1 -1
- package/build/src/modeling/DomainAssociation.d.ts +281 -0
- package/build/src/modeling/DomainAssociation.d.ts.map +1 -0
- package/build/src/modeling/DomainAssociation.js +440 -0
- package/build/src/modeling/DomainAssociation.js.map +1 -0
- package/build/src/modeling/DomainElement.d.ts +33 -0
- package/build/src/modeling/DomainElement.d.ts.map +1 -0
- package/build/src/modeling/DomainElement.js +32 -0
- package/build/src/modeling/DomainElement.js.map +1 -0
- package/build/src/modeling/DomainEntity.d.ts +383 -0
- package/build/src/modeling/DomainEntity.d.ts.map +1 -0
- package/build/src/modeling/DomainEntity.js +718 -0
- package/build/src/modeling/DomainEntity.js.map +1 -0
- package/build/src/modeling/DomainFile.d.ts +25 -0
- package/build/src/modeling/DomainFile.d.ts.map +1 -0
- package/build/src/modeling/DomainFile.js +86 -0
- package/build/src/modeling/DomainFile.js.map +1 -0
- package/build/src/modeling/DomainImpactAnalysis.d.ts +60 -47
- package/build/src/modeling/DomainImpactAnalysis.d.ts.map +1 -1
- package/build/src/modeling/DomainImpactAnalysis.js +201 -132
- package/build/src/modeling/DomainImpactAnalysis.js.map +1 -1
- package/build/src/modeling/DomainModel.d.ts +226 -0
- package/build/src/modeling/DomainModel.d.ts.map +1 -0
- package/build/src/modeling/DomainModel.js +401 -0
- package/build/src/modeling/DomainModel.js.map +1 -0
- package/build/src/modeling/DomainNamespace.d.ts +268 -0
- package/build/src/modeling/DomainNamespace.d.ts.map +1 -0
- package/build/src/modeling/DomainNamespace.js +512 -0
- package/build/src/modeling/DomainNamespace.js.map +1 -0
- package/build/src/modeling/DomainProperty.d.ts +281 -0
- package/build/src/modeling/DomainProperty.d.ts.map +1 -0
- package/build/src/modeling/DomainProperty.js +560 -0
- package/build/src/modeling/DomainProperty.js.map +1 -0
- package/build/src/modeling/DomainSerialization.d.ts +40 -0
- package/build/src/modeling/DomainSerialization.d.ts.map +1 -0
- package/build/src/modeling/DomainSerialization.js +288 -0
- package/build/src/modeling/DomainSerialization.js.map +1 -0
- package/build/src/modeling/DomainVersioning.d.ts +17 -0
- package/build/src/modeling/DomainVersioning.d.ts.map +1 -0
- package/build/src/modeling/DomainVersioning.js +124 -0
- package/build/src/modeling/DomainVersioning.js.map +1 -0
- package/build/src/modeling/GraphUtils.d.ts +8 -0
- package/build/src/modeling/GraphUtils.d.ts.map +1 -0
- package/build/src/modeling/GraphUtils.js +26 -0
- package/build/src/modeling/GraphUtils.js.map +1 -0
- package/build/src/modeling/amf/ShapeGenerator.d.ts +164 -0
- package/build/src/modeling/amf/ShapeGenerator.d.ts.map +1 -0
- package/build/src/modeling/amf/ShapeGenerator.js +492 -0
- package/build/src/modeling/amf/ShapeGenerator.js.map +1 -0
- package/build/src/modeling/{DataAssociation.d.ts → legacy/DataAssociation.d.ts} +10 -5
- package/build/src/modeling/legacy/DataAssociation.d.ts.map +1 -0
- package/build/src/modeling/{DataAssociation.js → legacy/DataAssociation.js} +9 -6
- package/build/src/modeling/legacy/DataAssociation.js.map +1 -0
- package/build/src/modeling/{DataEntity.d.ts → legacy/DataEntity.d.ts} +12 -7
- package/build/src/modeling/legacy/DataEntity.d.ts.map +1 -0
- package/build/src/modeling/{DataEntity.js → legacy/DataEntity.js} +19 -18
- package/build/src/modeling/legacy/DataEntity.js.map +1 -0
- package/build/src/modeling/{DataEntityBuilder.d.ts → legacy/DataEntityBuilder.d.ts} +3 -2
- package/build/src/modeling/legacy/DataEntityBuilder.d.ts.map +1 -0
- package/build/src/modeling/{DataEntityBuilder.js → legacy/DataEntityBuilder.js} +3 -2
- package/build/src/modeling/legacy/DataEntityBuilder.js.map +1 -0
- package/build/src/modeling/legacy/DataImpactAnalysis.d.ts +298 -0
- package/build/src/modeling/legacy/DataImpactAnalysis.d.ts.map +1 -0
- package/build/src/modeling/legacy/DataImpactAnalysis.js +441 -0
- package/build/src/modeling/legacy/DataImpactAnalysis.js.map +1 -0
- package/build/src/modeling/{DataModel.d.ts → legacy/DataModel.d.ts} +6 -4
- package/build/src/modeling/legacy/DataModel.d.ts.map +1 -0
- package/build/src/modeling/{DataModel.js → legacy/DataModel.js} +7 -6
- package/build/src/modeling/legacy/DataModel.js.map +1 -0
- package/build/src/modeling/{DataNamespace.d.ts → legacy/DataNamespace.d.ts} +22 -3
- package/build/src/modeling/legacy/DataNamespace.d.ts.map +1 -0
- package/build/src/modeling/{DataNamespace.js → legacy/DataNamespace.js} +7 -3
- package/build/src/modeling/legacy/DataNamespace.js.map +1 -0
- package/build/src/modeling/{DataProperty.d.ts → legacy/DataProperty.d.ts} +13 -5
- package/build/src/modeling/legacy/DataProperty.d.ts.map +1 -0
- package/build/src/modeling/{DataProperty.js → legacy/DataProperty.js} +8 -5
- package/build/src/modeling/legacy/DataProperty.js.map +1 -0
- package/build/src/modeling/observed.d.ts +67 -0
- package/build/src/modeling/observed.d.ts.map +1 -0
- package/build/src/modeling/observed.js +230 -0
- package/build/src/modeling/observed.js.map +1 -0
- package/build/src/modeling/types.d.ts +165 -1
- package/build/src/modeling/types.d.ts.map +1 -1
- package/build/src/modeling/types.js.map +1 -1
- package/build/src/models/Thing.d.ts +26 -5
- package/build/src/models/Thing.d.ts.map +1 -1
- package/build/src/models/Thing.js +193 -91
- package/build/src/models/Thing.js.map +1 -1
- package/build/src/models/kinds.d.ts +31 -6
- package/build/src/models/kinds.d.ts.map +1 -1
- package/build/src/models/kinds.js +31 -6
- package/build/src/models/kinds.js.map +1 -1
- package/build/src/models/store/DataFile.d.ts +3 -1
- package/build/src/models/store/DataFile.d.ts.map +1 -1
- package/build/src/models/store/DataFile.js +2 -0
- package/build/src/models/store/DataFile.js.map +1 -1
- package/build/src/models/types.d.ts +12 -0
- package/build/src/models/types.d.ts.map +1 -0
- package/build/src/models/types.js +2 -0
- package/build/src/models/types.js.map +1 -0
- package/build/src/runtime/store/FilesSdk.d.ts +2 -2
- package/build/src/runtime/store/FilesSdk.d.ts.map +1 -1
- package/build/src/runtime/store/FilesSdk.js.map +1 -1
- package/data/models/example-generator-api.json +16 -16
- package/package.json +20 -6
- package/readme.md +1 -1
- package/src/amf/AmfShapeGenerator.ts +7 -4
- package/src/amf/AmfTypes.ts +2 -2
- package/src/amf/DataValueGenerator.ts +21 -21
- package/src/exceptions/attach_exception.ts +11 -0
- package/src/exceptions/detach_exception.ts +11 -0
- package/src/exceptions/remove_model_exception.ts +8 -0
- package/src/exceptions/remove_namespace_exception.ts +8 -0
- package/src/modeling/Bindings.ts +2 -2
- package/src/modeling/DataDomain.ts +1221 -0
- package/src/modeling/DataFormat.ts +54 -163
- package/src/modeling/DomainAssociation.ts +476 -0
- package/src/modeling/DomainElement.ts +50 -0
- package/src/modeling/DomainEntity.ts +769 -0
- package/src/modeling/DomainFile.ts +94 -0
- package/src/modeling/DomainImpactAnalysis.ts +218 -144
- package/src/modeling/DomainModel.ts +421 -0
- package/src/modeling/DomainNamespace.ts +537 -0
- package/src/modeling/DomainProperty.ts +548 -0
- package/src/modeling/DomainSerialization.ts +312 -0
- package/src/modeling/DomainVersioning.ts +144 -0
- package/src/modeling/GraphUtils.ts +28 -0
- package/src/modeling/amf/ShapeGenerator.ts +552 -0
- package/src/modeling/graph.md +115 -0
- package/src/modeling/{DataAssociation.ts → legacy/DataAssociation.ts} +13 -8
- package/src/modeling/{DataEntity.ts → legacy/DataEntity.ts} +28 -23
- package/src/modeling/{DataEntityBuilder.ts → legacy/DataEntityBuilder.ts} +4 -3
- package/src/modeling/legacy/DataImpactAnalysis.ts +530 -0
- package/src/modeling/{DataModel.ts → legacy/DataModel.ts} +10 -8
- package/src/modeling/{DataNamespace.ts → legacy/DataNamespace.ts} +23 -5
- package/src/modeling/{DataProperty.ts → legacy/DataProperty.ts} +15 -7
- package/src/modeling/observed.ts +267 -0
- package/src/modeling/types.ts +174 -1
- package/src/models/Thing.ts +70 -5
- package/src/models/kinds.ts +32 -6
- package/src/models/store/DataFile.ts +3 -1
- package/src/models/types.ts +11 -0
- package/src/runtime/store/FilesSdk.ts +2 -2
- package/tests/unit/amf/data_value_generator.spec.ts +15 -15
- package/tests/unit/legacy-transformers/ARC-legacy-import.spec.ts +1 -1
- package/tests/unit/modeling/amf/shape_generator.spec.ts +1174 -0
- package/tests/unit/modeling/data_domain.spec.ts +444 -0
- package/tests/unit/modeling/data_domain_associations.spec.ts +279 -0
- package/tests/unit/modeling/data_domain_change_observers.spec.ts +681 -0
- package/tests/unit/modeling/data_domain_entities.spec.ts +449 -0
- package/tests/unit/modeling/data_domain_foreign.spec.ts +355 -0
- package/tests/unit/modeling/data_domain_models.spec.ts +658 -0
- package/tests/unit/modeling/data_domain_namespaces.spec.ts +668 -0
- package/tests/unit/modeling/data_domain_property.spec.ts +264 -0
- package/tests/unit/modeling/data_domain_serialization.spec.ts +294 -0
- package/tests/unit/modeling/domain.property.spec.ts +822 -0
- package/tests/unit/modeling/domain_asociation.spec.ts +643 -0
- package/tests/unit/modeling/domain_asociation_targets.spec.ts +350 -0
- package/tests/unit/modeling/domain_entity.spec.ts +730 -0
- package/tests/unit/modeling/domain_entity_associations.spec.ts +330 -0
- package/tests/unit/modeling/domain_entity_example_generator_json.spec.ts +988 -0
- package/tests/unit/modeling/domain_entity_example_generator_xml.spec.ts +1451 -0
- package/tests/unit/modeling/domain_entity_fields.spec.ts +113 -0
- package/tests/unit/modeling/domain_entity_generators.spec.ts +20 -0
- package/tests/unit/modeling/domain_entity_parents.spec.ts +291 -0
- package/tests/unit/modeling/domain_entity_properties.spec.ts +305 -0
- package/tests/unit/modeling/{data_file.spec.ts → domain_file.spec.ts} +29 -85
- package/tests/unit/modeling/domain_impact_analysis.spec.ts +452 -0
- package/tests/unit/modeling/domain_model.spec.ts +568 -0
- package/tests/unit/modeling/domain_model_entities.spec.ts +408 -0
- package/tests/unit/modeling/domain_namespace.spec.ts +514 -0
- package/tests/unit/modeling/domain_namespace_models.spec.ts +324 -0
- package/tests/unit/modeling/domain_namespace_namespaces.spec.ts +404 -0
- package/tests/unit/modeling/domain_versioning.spec.ts +140 -0
- package/tests/unit/{amf → modeling/legacy}/amf_shape_generator.spec.ts +11 -11
- package/tests/unit/modeling/{data_association.spec.ts → legacy/data_association.spec.ts} +3 -11
- package/tests/unit/modeling/{data_entity.spec.ts → legacy/data_entity.spec.ts} +10 -8
- package/tests/unit/modeling/{data_entity_generator_json.spec.ts → legacy/data_entity_generator_json.spec.ts} +1 -1
- package/tests/unit/modeling/{data_entity_generator_xml.spec.ts → legacy/data_entity_generator_xml.spec.ts} +1 -1
- package/tests/unit/modeling/{data_model.spec.ts → legacy/data_model.spec.ts} +3 -3
- package/tests/unit/modeling/{data_namespace.spec.ts → legacy/data_namespace.spec.ts} +3 -10
- package/tests/unit/modeling/{data_property.spec.ts → legacy/data_property.spec.ts} +3 -6
- package/tests/unit/modeling/{impact_analysis.spec.ts → legacy/impact_analysis.spec.ts} +9 -9
- package/tests/unit/models/File/new.spec.ts +1 -1
- package/tests/unit/models/HttpProject.spec.ts +3 -3
- package/tsconfig.node.json +35 -0
- package/build/src/modeling/DataAssociation.d.ts.map +0 -1
- package/build/src/modeling/DataAssociation.js.map +0 -1
- package/build/src/modeling/DataEntity.d.ts.map +0 -1
- package/build/src/modeling/DataEntity.js.map +0 -1
- package/build/src/modeling/DataEntityBuilder.d.ts.map +0 -1
- package/build/src/modeling/DataEntityBuilder.js.map +0 -1
- package/build/src/modeling/DataModel.d.ts.map +0 -1
- package/build/src/modeling/DataModel.js.map +0 -1
- package/build/src/modeling/DataNamespace.d.ts.map +0 -1
- package/build/src/modeling/DataNamespace.js.map +0 -1
- package/build/src/modeling/DataProperty.d.ts.map +0 -1
- package/build/src/modeling/DataProperty.js.map +0 -1
|
@@ -0,0 +1,681 @@
|
|
|
1
|
+
import { test } from '@japa/runner'
|
|
2
|
+
import { DataDomain, DataFormat } from '../../../src/index.js'
|
|
3
|
+
|
|
4
|
+
test.group('DataDomain change observers', () => {
|
|
5
|
+
test('does not notifies a change when initializing a domain', async ({ assert }) => {
|
|
6
|
+
const domain = new DataDomain()
|
|
7
|
+
await assert.notDispatches(domain, 'change', { timeout: 1 })
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
test('notifies a change when changing info.name', async ({ assert }) => {
|
|
11
|
+
const domain = new DataDomain()
|
|
12
|
+
domain.info.name = 'test'
|
|
13
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
test('notifies a change when changing info.description', async ({ assert }) => {
|
|
17
|
+
const domain = new DataDomain()
|
|
18
|
+
domain.info.description = 'test'
|
|
19
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
test('notifies a change when changing info.displayName', async ({ assert }) => {
|
|
23
|
+
const domain = new DataDomain()
|
|
24
|
+
domain.info.displayName = 'test'
|
|
25
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
test('notifies a change when changing info.version', async ({ assert }) => {
|
|
29
|
+
const domain = new DataDomain()
|
|
30
|
+
domain.info.version = 'test'
|
|
31
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
test.group('DomainNamespace change observers', () => {
|
|
36
|
+
test('notifies a change when changing info.name', async ({ assert, sleep }) => {
|
|
37
|
+
const domain = new DataDomain()
|
|
38
|
+
const n1 = domain.addNamespace()
|
|
39
|
+
await sleep(1)
|
|
40
|
+
n1.info.name = 'test'
|
|
41
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
test('notifies a change when changing info.description', async ({ assert, sleep }) => {
|
|
45
|
+
const domain = new DataDomain()
|
|
46
|
+
const n1 = domain.addNamespace()
|
|
47
|
+
await sleep(1)
|
|
48
|
+
n1.info.description = 'test'
|
|
49
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
test('notifies a change when changing info.displayName', async ({ assert, sleep }) => {
|
|
53
|
+
const domain = new DataDomain()
|
|
54
|
+
const n1 = domain.addNamespace()
|
|
55
|
+
await sleep(1)
|
|
56
|
+
n1.info.displayName = 'test'
|
|
57
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
test('notifies a change when changing info.version', async ({ assert, sleep }) => {
|
|
61
|
+
const domain = new DataDomain()
|
|
62
|
+
const n1 = domain.addNamespace()
|
|
63
|
+
await sleep(1)
|
|
64
|
+
n1.info.version = 'test'
|
|
65
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
test('notifies a change when changing deprecated', async ({ assert, sleep }) => {
|
|
69
|
+
const domain = new DataDomain()
|
|
70
|
+
const n1 = domain.addNamespace()
|
|
71
|
+
await sleep(1)
|
|
72
|
+
n1.deprecated = true
|
|
73
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
test('notifies when adding a new namespace', async ({ assert, sleep }) => {
|
|
77
|
+
const domain = new DataDomain()
|
|
78
|
+
const n1 = domain.addNamespace()
|
|
79
|
+
await sleep(1)
|
|
80
|
+
n1.addNamespace()
|
|
81
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
test('notifies when removing new namespace', async ({ assert, sleep }) => {
|
|
85
|
+
const domain = new DataDomain()
|
|
86
|
+
const n1 = domain.addNamespace()
|
|
87
|
+
const n2 = n1.addNamespace()
|
|
88
|
+
await sleep(1)
|
|
89
|
+
n1.removeNamespace(n2.key)
|
|
90
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
test('notifies when attaching a namespace', async ({ assert, sleep }) => {
|
|
94
|
+
const domain = new DataDomain()
|
|
95
|
+
const n1 = domain.addNamespace()
|
|
96
|
+
const n2 = n1.addNamespace()
|
|
97
|
+
const n3 = domain.addNamespace()
|
|
98
|
+
await sleep(1)
|
|
99
|
+
n2.attachNamespace(n3.key)
|
|
100
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
test('notifies when adding a new model', async ({ assert, sleep }) => {
|
|
104
|
+
const domain = new DataDomain()
|
|
105
|
+
const n1 = domain.addNamespace()
|
|
106
|
+
await sleep(1)
|
|
107
|
+
n1.addModel()
|
|
108
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
test('notifies when removing a model', async ({ assert, sleep }) => {
|
|
112
|
+
const domain = new DataDomain()
|
|
113
|
+
const n1 = domain.addNamespace()
|
|
114
|
+
const m1 = n1.addModel()
|
|
115
|
+
await sleep(1)
|
|
116
|
+
n1.removeModel(m1.key)
|
|
117
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
test('notifies when attaching a model', async ({ assert, sleep }) => {
|
|
121
|
+
const domain = new DataDomain()
|
|
122
|
+
const n1 = domain.addNamespace()
|
|
123
|
+
const m1 = domain.addModel()
|
|
124
|
+
await sleep(1)
|
|
125
|
+
n1.attachModel(m1.key)
|
|
126
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
127
|
+
})
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
test.group('DomainModel change observers', () => {
|
|
131
|
+
test('notifies a change when changing info.name', async ({ assert, sleep }) => {
|
|
132
|
+
const domain = new DataDomain()
|
|
133
|
+
const n1 = domain.addNamespace()
|
|
134
|
+
const m1 = n1.addModel()
|
|
135
|
+
await sleep(1)
|
|
136
|
+
m1.info.name = 'test'
|
|
137
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
test('notifies a change when changing info.description', async ({ assert, sleep }) => {
|
|
141
|
+
const domain = new DataDomain()
|
|
142
|
+
const n1 = domain.addNamespace()
|
|
143
|
+
const m1 = n1.addModel()
|
|
144
|
+
await sleep(1)
|
|
145
|
+
m1.info.description = 'test'
|
|
146
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
test('notifies a change when changing info.displayName', async ({ assert, sleep }) => {
|
|
150
|
+
const domain = new DataDomain()
|
|
151
|
+
const n1 = domain.addNamespace()
|
|
152
|
+
const m1 = n1.addModel()
|
|
153
|
+
await sleep(1)
|
|
154
|
+
m1.info.displayName = 'test'
|
|
155
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
test('notifies a change when changing info.version', async ({ assert, sleep }) => {
|
|
159
|
+
const domain = new DataDomain()
|
|
160
|
+
const n1 = domain.addNamespace()
|
|
161
|
+
const m1 = n1.addModel()
|
|
162
|
+
await sleep(1)
|
|
163
|
+
m1.info.version = 'test'
|
|
164
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
test('notifies a change when changing deprecated', async ({ assert, sleep }) => {
|
|
168
|
+
const domain = new DataDomain()
|
|
169
|
+
const n1 = domain.addNamespace()
|
|
170
|
+
const m1 = n1.addModel()
|
|
171
|
+
await sleep(1)
|
|
172
|
+
m1.deprecated = true
|
|
173
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
test('notifies when adding a new entity', async ({ assert, sleep }) => {
|
|
177
|
+
const domain = new DataDomain()
|
|
178
|
+
const n1 = domain.addNamespace()
|
|
179
|
+
const m1 = n1.addModel()
|
|
180
|
+
await sleep(1)
|
|
181
|
+
m1.addEntity()
|
|
182
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
test('notifies when removing an entity', async ({ assert, sleep }) => {
|
|
186
|
+
const domain = new DataDomain()
|
|
187
|
+
const n1 = domain.addNamespace()
|
|
188
|
+
const m1 = n1.addModel()
|
|
189
|
+
const e1 = m1.addEntity()
|
|
190
|
+
await sleep(1)
|
|
191
|
+
m1.removeEntity(e1.key)
|
|
192
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
193
|
+
})
|
|
194
|
+
|
|
195
|
+
test('notifies when attaching an entity', async ({ assert, sleep }) => {
|
|
196
|
+
const domain = new DataDomain()
|
|
197
|
+
const n1 = domain.addNamespace()
|
|
198
|
+
const m1 = n1.addModel()
|
|
199
|
+
const m2 = n1.addModel()
|
|
200
|
+
const e1 = m2.addEntity()
|
|
201
|
+
await sleep(1)
|
|
202
|
+
m1.attachEntity(e1.key)
|
|
203
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
204
|
+
})
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
test.group('DomainEntity change observers', () => {
|
|
208
|
+
test('notifies a change when changing info.name', async ({ assert, sleep }) => {
|
|
209
|
+
const domain = new DataDomain()
|
|
210
|
+
const n1 = domain.addNamespace()
|
|
211
|
+
const m1 = n1.addModel()
|
|
212
|
+
const e1 = m1.addEntity()
|
|
213
|
+
await sleep(1)
|
|
214
|
+
e1.info.name = 'test'
|
|
215
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
test('notifies a change when changing info.description', async ({ assert, sleep }) => {
|
|
219
|
+
const domain = new DataDomain()
|
|
220
|
+
const n1 = domain.addNamespace()
|
|
221
|
+
const m1 = n1.addModel()
|
|
222
|
+
const e1 = m1.addEntity()
|
|
223
|
+
await sleep(1)
|
|
224
|
+
e1.info.description = 'test'
|
|
225
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
226
|
+
})
|
|
227
|
+
|
|
228
|
+
test('notifies a change when changing info.displayName', async ({ assert, sleep }) => {
|
|
229
|
+
const domain = new DataDomain()
|
|
230
|
+
const n1 = domain.addNamespace()
|
|
231
|
+
const m1 = n1.addModel()
|
|
232
|
+
const e1 = m1.addEntity()
|
|
233
|
+
await sleep(1)
|
|
234
|
+
e1.info.displayName = 'test'
|
|
235
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
236
|
+
})
|
|
237
|
+
|
|
238
|
+
test('notifies a change when changing info.version', async ({ assert, sleep }) => {
|
|
239
|
+
const domain = new DataDomain()
|
|
240
|
+
const n1 = domain.addNamespace()
|
|
241
|
+
const m1 = n1.addModel()
|
|
242
|
+
const e1 = m1.addEntity()
|
|
243
|
+
await sleep(1)
|
|
244
|
+
e1.info.version = 'test'
|
|
245
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
246
|
+
})
|
|
247
|
+
|
|
248
|
+
test('notifies a change when changing deprecated', async ({ assert, sleep }) => {
|
|
249
|
+
const domain = new DataDomain()
|
|
250
|
+
const n1 = domain.addNamespace()
|
|
251
|
+
const m1 = n1.addModel()
|
|
252
|
+
const e1 = m1.addEntity()
|
|
253
|
+
await sleep(1)
|
|
254
|
+
e1.deprecated = true
|
|
255
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
256
|
+
})
|
|
257
|
+
|
|
258
|
+
test('notifies a change when adding a tag', async ({ assert, sleep }) => {
|
|
259
|
+
const domain = new DataDomain()
|
|
260
|
+
const n1 = domain.addNamespace()
|
|
261
|
+
const m1 = n1.addModel()
|
|
262
|
+
const e1 = m1.addEntity()
|
|
263
|
+
await sleep(1)
|
|
264
|
+
e1.tags.push('test')
|
|
265
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
266
|
+
})
|
|
267
|
+
|
|
268
|
+
test('notifies a change when removing a tag', async ({ assert, sleep }) => {
|
|
269
|
+
const domain = new DataDomain()
|
|
270
|
+
const n1 = domain.addNamespace()
|
|
271
|
+
const m1 = n1.addModel()
|
|
272
|
+
const e1 = m1.addEntity()
|
|
273
|
+
e1.tags.push('test')
|
|
274
|
+
await sleep(1)
|
|
275
|
+
e1.tags.pop()
|
|
276
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
277
|
+
})
|
|
278
|
+
|
|
279
|
+
test('notifies a change when adding a taxonomy', async ({ assert, sleep }) => {
|
|
280
|
+
const domain = new DataDomain()
|
|
281
|
+
const n1 = domain.addNamespace()
|
|
282
|
+
const m1 = n1.addModel()
|
|
283
|
+
const e1 = m1.addEntity()
|
|
284
|
+
await sleep(1)
|
|
285
|
+
e1.taxonomy.push('test')
|
|
286
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
287
|
+
})
|
|
288
|
+
|
|
289
|
+
test('notifies a change when removing a taxonomy', async ({ assert, sleep }) => {
|
|
290
|
+
const domain = new DataDomain()
|
|
291
|
+
const n1 = domain.addNamespace()
|
|
292
|
+
const m1 = n1.addModel()
|
|
293
|
+
const e1 = m1.addEntity()
|
|
294
|
+
e1.taxonomy.push('test')
|
|
295
|
+
await sleep(1)
|
|
296
|
+
e1.taxonomy.pop()
|
|
297
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
298
|
+
})
|
|
299
|
+
|
|
300
|
+
test('notifies when adding a new property', async ({ assert, sleep }) => {
|
|
301
|
+
const domain = new DataDomain()
|
|
302
|
+
const n1 = domain.addNamespace()
|
|
303
|
+
const m1 = n1.addModel()
|
|
304
|
+
const e1 = m1.addEntity()
|
|
305
|
+
await sleep(1)
|
|
306
|
+
e1.addProperty()
|
|
307
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
308
|
+
})
|
|
309
|
+
|
|
310
|
+
test('notifies when removing a property', async ({ assert, sleep }) => {
|
|
311
|
+
const domain = new DataDomain()
|
|
312
|
+
const n1 = domain.addNamespace()
|
|
313
|
+
const m1 = n1.addModel()
|
|
314
|
+
const e1 = m1.addEntity()
|
|
315
|
+
const p1 = e1.addProperty()
|
|
316
|
+
await sleep(1)
|
|
317
|
+
e1.removeProperty(p1.key)
|
|
318
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
319
|
+
})
|
|
320
|
+
|
|
321
|
+
test('notifies when adding a new parent', async ({ assert, sleep }) => {
|
|
322
|
+
const domain = new DataDomain()
|
|
323
|
+
const n1 = domain.addNamespace()
|
|
324
|
+
const m1 = n1.addModel()
|
|
325
|
+
const e1 = m1.addEntity()
|
|
326
|
+
const e2 = m1.addEntity()
|
|
327
|
+
await sleep(1)
|
|
328
|
+
e1.addParent(e2.key)
|
|
329
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
330
|
+
})
|
|
331
|
+
|
|
332
|
+
test('notifies when removing a parent', async ({ assert, sleep }) => {
|
|
333
|
+
const domain = new DataDomain()
|
|
334
|
+
const n1 = domain.addNamespace()
|
|
335
|
+
const m1 = n1.addModel()
|
|
336
|
+
const e1 = m1.addEntity()
|
|
337
|
+
const e2 = m1.addEntity()
|
|
338
|
+
e1.addParent(e2.key)
|
|
339
|
+
await sleep(1)
|
|
340
|
+
e1.removeParent(e2.key)
|
|
341
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
342
|
+
})
|
|
343
|
+
|
|
344
|
+
test('notifies when adding a new association', async ({ assert, sleep }) => {
|
|
345
|
+
const domain = new DataDomain()
|
|
346
|
+
const n1 = domain.addNamespace()
|
|
347
|
+
const m1 = n1.addModel()
|
|
348
|
+
const e1 = m1.addEntity()
|
|
349
|
+
await sleep(1)
|
|
350
|
+
e1.addAssociation()
|
|
351
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
352
|
+
})
|
|
353
|
+
|
|
354
|
+
test('notifies when removing an association', async ({ assert, sleep }) => {
|
|
355
|
+
const domain = new DataDomain()
|
|
356
|
+
const n1 = domain.addNamespace()
|
|
357
|
+
const m1 = n1.addModel()
|
|
358
|
+
const e1 = m1.addEntity()
|
|
359
|
+
const a1 = e1.addAssociation()
|
|
360
|
+
await sleep(1)
|
|
361
|
+
e1.removeAssociation(a1.key)
|
|
362
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
363
|
+
})
|
|
364
|
+
})
|
|
365
|
+
|
|
366
|
+
test.group('DomainProperty change observers', () => {
|
|
367
|
+
test('notifies a change when changing info.name', async ({ assert, sleep }) => {
|
|
368
|
+
const domain = new DataDomain()
|
|
369
|
+
const n1 = domain.addNamespace()
|
|
370
|
+
const m1 = n1.addModel()
|
|
371
|
+
const e1 = m1.addEntity()
|
|
372
|
+
const p1 = e1.addProperty()
|
|
373
|
+
await sleep(1)
|
|
374
|
+
p1.info.name = 'test'
|
|
375
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
376
|
+
})
|
|
377
|
+
|
|
378
|
+
test('notifies a change when changing info.description', async ({ assert, sleep }) => {
|
|
379
|
+
const domain = new DataDomain()
|
|
380
|
+
const n1 = domain.addNamespace()
|
|
381
|
+
const m1 = n1.addModel()
|
|
382
|
+
const e1 = m1.addEntity()
|
|
383
|
+
const p1 = e1.addProperty()
|
|
384
|
+
await sleep(1)
|
|
385
|
+
p1.info.description = 'test'
|
|
386
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
387
|
+
})
|
|
388
|
+
|
|
389
|
+
test('notifies a change when changing info.displayName', async ({ assert, sleep }) => {
|
|
390
|
+
const domain = new DataDomain()
|
|
391
|
+
const n1 = domain.addNamespace()
|
|
392
|
+
const m1 = n1.addModel()
|
|
393
|
+
const e1 = m1.addEntity()
|
|
394
|
+
const p1 = e1.addProperty()
|
|
395
|
+
await sleep(1)
|
|
396
|
+
p1.info.displayName = 'test'
|
|
397
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
398
|
+
})
|
|
399
|
+
|
|
400
|
+
test('notifies a change when changing info.version', async ({ assert, sleep }) => {
|
|
401
|
+
const domain = new DataDomain()
|
|
402
|
+
const n1 = domain.addNamespace()
|
|
403
|
+
const m1 = n1.addModel()
|
|
404
|
+
const e1 = m1.addEntity()
|
|
405
|
+
const p1 = e1.addProperty()
|
|
406
|
+
await sleep(1)
|
|
407
|
+
p1.info.version = 'test'
|
|
408
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
409
|
+
})
|
|
410
|
+
|
|
411
|
+
test('notifies a change when changing required', async ({ assert, sleep }) => {
|
|
412
|
+
const domain = new DataDomain()
|
|
413
|
+
const n1 = domain.addNamespace()
|
|
414
|
+
const m1 = n1.addModel()
|
|
415
|
+
const e1 = m1.addEntity()
|
|
416
|
+
const p1 = e1.addProperty()
|
|
417
|
+
await sleep(1)
|
|
418
|
+
p1.required = true
|
|
419
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
420
|
+
})
|
|
421
|
+
|
|
422
|
+
test('notifies a change when changing multiple', async ({ assert, sleep }) => {
|
|
423
|
+
const domain = new DataDomain()
|
|
424
|
+
const n1 = domain.addNamespace()
|
|
425
|
+
const m1 = n1.addModel()
|
|
426
|
+
const e1 = m1.addEntity()
|
|
427
|
+
const p1 = e1.addProperty()
|
|
428
|
+
await sleep(1)
|
|
429
|
+
p1.multiple = true
|
|
430
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
431
|
+
})
|
|
432
|
+
|
|
433
|
+
test('notifies a change when changing primary', async ({ assert, sleep }) => {
|
|
434
|
+
const domain = new DataDomain()
|
|
435
|
+
const n1 = domain.addNamespace()
|
|
436
|
+
const m1 = n1.addModel()
|
|
437
|
+
const e1 = m1.addEntity()
|
|
438
|
+
const p1 = e1.addProperty()
|
|
439
|
+
await sleep(1)
|
|
440
|
+
p1.primary = true
|
|
441
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
442
|
+
})
|
|
443
|
+
|
|
444
|
+
test('notifies a change when changing index', async ({ assert, sleep }) => {
|
|
445
|
+
const domain = new DataDomain()
|
|
446
|
+
const n1 = domain.addNamespace()
|
|
447
|
+
const m1 = n1.addModel()
|
|
448
|
+
const e1 = m1.addEntity()
|
|
449
|
+
const p1 = e1.addProperty()
|
|
450
|
+
await sleep(1)
|
|
451
|
+
p1.index = true
|
|
452
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
453
|
+
})
|
|
454
|
+
|
|
455
|
+
test('notifies a change when changing readOnly', async ({ assert, sleep }) => {
|
|
456
|
+
const domain = new DataDomain()
|
|
457
|
+
const n1 = domain.addNamespace()
|
|
458
|
+
const m1 = n1.addModel()
|
|
459
|
+
const e1 = m1.addEntity()
|
|
460
|
+
const p1 = e1.addProperty()
|
|
461
|
+
await sleep(1)
|
|
462
|
+
p1.readOnly = true
|
|
463
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
464
|
+
})
|
|
465
|
+
|
|
466
|
+
test('notifies a change when changing writeOnly', async ({ assert, sleep }) => {
|
|
467
|
+
const domain = new DataDomain()
|
|
468
|
+
const n1 = domain.addNamespace()
|
|
469
|
+
const m1 = n1.addModel()
|
|
470
|
+
const e1 = m1.addEntity()
|
|
471
|
+
const p1 = e1.addProperty()
|
|
472
|
+
await sleep(1)
|
|
473
|
+
p1.writeOnly = true
|
|
474
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
475
|
+
})
|
|
476
|
+
|
|
477
|
+
test('notifies a change when changing deprecated', async ({ assert, sleep }) => {
|
|
478
|
+
const domain = new DataDomain()
|
|
479
|
+
const n1 = domain.addNamespace()
|
|
480
|
+
const m1 = n1.addModel()
|
|
481
|
+
const e1 = m1.addEntity()
|
|
482
|
+
const p1 = e1.addProperty()
|
|
483
|
+
await sleep(1)
|
|
484
|
+
p1.deprecated = true
|
|
485
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
486
|
+
})
|
|
487
|
+
|
|
488
|
+
test('notifies a change when adding a tag', async ({ assert, sleep }) => {
|
|
489
|
+
const domain = new DataDomain()
|
|
490
|
+
const n1 = domain.addNamespace()
|
|
491
|
+
const m1 = n1.addModel()
|
|
492
|
+
const e1 = m1.addEntity()
|
|
493
|
+
const p1 = e1.addProperty()
|
|
494
|
+
await sleep(1)
|
|
495
|
+
p1.tags.push('test')
|
|
496
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
497
|
+
})
|
|
498
|
+
|
|
499
|
+
test('notifies a change when removing a tag', async ({ assert, sleep }) => {
|
|
500
|
+
const domain = new DataDomain()
|
|
501
|
+
const n1 = domain.addNamespace()
|
|
502
|
+
const m1 = n1.addModel()
|
|
503
|
+
const e1 = m1.addEntity()
|
|
504
|
+
const p1 = e1.addProperty()
|
|
505
|
+
p1.tags.push('test')
|
|
506
|
+
await sleep(1)
|
|
507
|
+
p1.tags.pop()
|
|
508
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
509
|
+
})
|
|
510
|
+
|
|
511
|
+
test('notifies a change when adding a taxonomy', async ({ assert, sleep }) => {
|
|
512
|
+
const domain = new DataDomain()
|
|
513
|
+
const n1 = domain.addNamespace()
|
|
514
|
+
const m1 = n1.addModel()
|
|
515
|
+
const e1 = m1.addEntity()
|
|
516
|
+
const p1 = e1.addProperty()
|
|
517
|
+
await sleep(1)
|
|
518
|
+
p1.taxonomy.push('test')
|
|
519
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
520
|
+
})
|
|
521
|
+
|
|
522
|
+
test('notifies a change when removing a taxonomy', async ({ assert, sleep }) => {
|
|
523
|
+
const domain = new DataDomain()
|
|
524
|
+
const n1 = domain.addNamespace()
|
|
525
|
+
const m1 = n1.addModel()
|
|
526
|
+
const e1 = m1.addEntity()
|
|
527
|
+
const p1 = e1.addProperty()
|
|
528
|
+
p1.taxonomy.push('test')
|
|
529
|
+
await sleep(1)
|
|
530
|
+
p1.taxonomy.pop()
|
|
531
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
532
|
+
})
|
|
533
|
+
|
|
534
|
+
test('notifies a change when changing type', async ({ assert, sleep }) => {
|
|
535
|
+
const domain = new DataDomain()
|
|
536
|
+
const n1 = domain.addNamespace()
|
|
537
|
+
const m1 = n1.addModel()
|
|
538
|
+
const e1 = m1.addEntity()
|
|
539
|
+
const p1 = e1.addProperty()
|
|
540
|
+
await sleep(1)
|
|
541
|
+
p1.type = DataFormat.DomainPropertyList.number
|
|
542
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
543
|
+
})
|
|
544
|
+
|
|
545
|
+
test('notifies a change when changing schema', async ({ assert, sleep }) => {
|
|
546
|
+
const domain = new DataDomain()
|
|
547
|
+
const n1 = domain.addNamespace()
|
|
548
|
+
const m1 = n1.addModel()
|
|
549
|
+
const e1 = m1.addEntity()
|
|
550
|
+
const p1 = e1.addProperty()
|
|
551
|
+
await sleep(1)
|
|
552
|
+
p1.schema = { minimum: 1 }
|
|
553
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
554
|
+
})
|
|
555
|
+
|
|
556
|
+
test('notifies a change when changing bindings', async ({ assert, sleep }) => {
|
|
557
|
+
const domain = new DataDomain()
|
|
558
|
+
const n1 = domain.addNamespace()
|
|
559
|
+
const m1 = n1.addModel()
|
|
560
|
+
const e1 = m1.addEntity()
|
|
561
|
+
const p1 = e1.addProperty()
|
|
562
|
+
await sleep(1)
|
|
563
|
+
p1.bindings.push({ type: 'web', schema: {} })
|
|
564
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
565
|
+
})
|
|
566
|
+
})
|
|
567
|
+
|
|
568
|
+
test.group('DomainAssociation change observers', () => {
|
|
569
|
+
test('notifies a change when changing info.name', async ({ assert, sleep }) => {
|
|
570
|
+
const domain = new DataDomain()
|
|
571
|
+
const n1 = domain.addNamespace()
|
|
572
|
+
const m1 = n1.addModel()
|
|
573
|
+
const e1 = m1.addEntity()
|
|
574
|
+
const a1 = e1.addAssociation()
|
|
575
|
+
await sleep(1)
|
|
576
|
+
a1.info.name = 'test'
|
|
577
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
578
|
+
})
|
|
579
|
+
|
|
580
|
+
test('notifies a change when changing info.description', async ({ assert, sleep }) => {
|
|
581
|
+
const domain = new DataDomain()
|
|
582
|
+
const n1 = domain.addNamespace()
|
|
583
|
+
const m1 = n1.addModel()
|
|
584
|
+
const e1 = m1.addEntity()
|
|
585
|
+
const a1 = e1.addAssociation()
|
|
586
|
+
await sleep(1)
|
|
587
|
+
a1.info.description = 'test'
|
|
588
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
589
|
+
})
|
|
590
|
+
|
|
591
|
+
test('notifies a change when changing info.displayName', async ({ assert, sleep }) => {
|
|
592
|
+
const domain = new DataDomain()
|
|
593
|
+
const n1 = domain.addNamespace()
|
|
594
|
+
const m1 = n1.addModel()
|
|
595
|
+
const e1 = m1.addEntity()
|
|
596
|
+
const a1 = e1.addAssociation()
|
|
597
|
+
await sleep(1)
|
|
598
|
+
a1.info.displayName = 'test'
|
|
599
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
600
|
+
})
|
|
601
|
+
|
|
602
|
+
test('notifies a change when changing info.version', async ({ assert, sleep }) => {
|
|
603
|
+
const domain = new DataDomain()
|
|
604
|
+
const n1 = domain.addNamespace()
|
|
605
|
+
const m1 = n1.addModel()
|
|
606
|
+
const e1 = m1.addEntity()
|
|
607
|
+
const a1 = e1.addAssociation()
|
|
608
|
+
await sleep(1)
|
|
609
|
+
a1.info.version = 'test'
|
|
610
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
611
|
+
})
|
|
612
|
+
|
|
613
|
+
test('notifies a change when changing required', async ({ assert, sleep }) => {
|
|
614
|
+
const domain = new DataDomain()
|
|
615
|
+
const n1 = domain.addNamespace()
|
|
616
|
+
const m1 = n1.addModel()
|
|
617
|
+
const e1 = m1.addEntity()
|
|
618
|
+
const a1 = e1.addAssociation()
|
|
619
|
+
await sleep(1)
|
|
620
|
+
a1.required = true
|
|
621
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
622
|
+
})
|
|
623
|
+
|
|
624
|
+
test('notifies a change when changing multiple', async ({ assert, sleep }) => {
|
|
625
|
+
const domain = new DataDomain()
|
|
626
|
+
const n1 = domain.addNamespace()
|
|
627
|
+
const m1 = n1.addModel()
|
|
628
|
+
const e1 = m1.addEntity()
|
|
629
|
+
const a1 = e1.addAssociation()
|
|
630
|
+
await sleep(1)
|
|
631
|
+
a1.multiple = true
|
|
632
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
633
|
+
})
|
|
634
|
+
|
|
635
|
+
test('notifies a change when changing schema', async ({ assert, sleep }) => {
|
|
636
|
+
const domain = new DataDomain()
|
|
637
|
+
const n1 = domain.addNamespace()
|
|
638
|
+
const m1 = n1.addModel()
|
|
639
|
+
const e1 = m1.addEntity()
|
|
640
|
+
const a1 = e1.addAssociation()
|
|
641
|
+
await sleep(1)
|
|
642
|
+
a1.schema = { linked: true }
|
|
643
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
644
|
+
})
|
|
645
|
+
|
|
646
|
+
test('notifies a change when adding a binding', async ({ assert, sleep }) => {
|
|
647
|
+
const domain = new DataDomain()
|
|
648
|
+
const n1 = domain.addNamespace()
|
|
649
|
+
const m1 = n1.addModel()
|
|
650
|
+
const e1 = m1.addEntity()
|
|
651
|
+
const a1 = e1.addAssociation()
|
|
652
|
+
await sleep(1)
|
|
653
|
+
a1.bindings.push({ type: 'web', schema: {} })
|
|
654
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
655
|
+
})
|
|
656
|
+
|
|
657
|
+
test('notifies a change when adding a target', async ({ assert, sleep }) => {
|
|
658
|
+
const domain = new DataDomain()
|
|
659
|
+
const n1 = domain.addNamespace()
|
|
660
|
+
const m1 = n1.addModel()
|
|
661
|
+
const e1 = m1.addEntity()
|
|
662
|
+
const e2 = m1.addEntity()
|
|
663
|
+
const a1 = e1.addAssociation()
|
|
664
|
+
await sleep(1)
|
|
665
|
+
a1.addTarget(e2.key)
|
|
666
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
667
|
+
})
|
|
668
|
+
|
|
669
|
+
test('notifies a change when removing a target', async ({ assert, sleep }) => {
|
|
670
|
+
const domain = new DataDomain()
|
|
671
|
+
const n1 = domain.addNamespace()
|
|
672
|
+
const m1 = n1.addModel()
|
|
673
|
+
const e1 = m1.addEntity()
|
|
674
|
+
const e2 = m1.addEntity()
|
|
675
|
+
const a1 = e1.addAssociation()
|
|
676
|
+
a1.addTarget(e2.key)
|
|
677
|
+
await sleep(1)
|
|
678
|
+
a1.removeTarget(e2.key)
|
|
679
|
+
await assert.dispatchCount(domain, 'change', 1, { timeout: 1 })
|
|
680
|
+
})
|
|
681
|
+
})
|