diff --git a/test/testfiles/valid2007B4withIEDModifications.scd b/test/testfiles/valid2007B4withIEDModifications.scd
index 41574b493..72443afde 100644
--- a/test/testfiles/valid2007B4withIEDModifications.scd
+++ b/test/testfiles/valid2007B4withIEDModifications.scd
@@ -145,6 +145,8 @@
+
+
sbo-with-enhanced-security
@@ -163,7 +165,7 @@
1
-
+
sbo-with-enhanced-security
@@ -330,6 +332,7 @@
+
@@ -479,6 +482,8 @@
+
+
@@ -531,12 +536,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
@@ -579,6 +584,8 @@
+
+
diff --git a/test/unit/editors/ied/do-container.test.ts b/test/unit/editors/ied/do-container.test.ts
index b4c3b4980..5f7974724 100644
--- a/test/unit/editors/ied/do-container.test.ts
+++ b/test/unit/editors/ied/do-container.test.ts
@@ -95,6 +95,16 @@ describe('do-container', () => {
expect(nestedDOs!.length).to.eql(1);
expect(nestedDOs![0].getAttribute('name')).to.eql('anotherSdo');
});
+
+ it('which return an empty array if the DoType cannot be found', async () => {
+ element = await fixture(html` DOType[id="Dummy.LLN0.Mod"] > SDO[name="sdoName2"]')}
+ >`);
+
+ const nestedDOs = element['getDOElements']();
+ expect(nestedDOs).to.be.empty;
+ });
it('which return an empty array if a DO doesn\t have child (S)DO\'s.', async () => {
element = await fixture(html` {
expect(nestedDOs).to.be.empty;
});
});
+
+ describe('has a getDAElements function ', () => {
+ it('which return the DA containers underneath a given DO.', async () => {
+ element = await fixture(html` LNodeType[id="Dummy.LLN0"] > DO[name="ExtendedMod"]')}
+ >`);
+
+ const nestedDOs = element['getDAElements']();
+ expect(nestedDOs).to.not.be.empty;
+ expect(nestedDOs!.length).to.eql(14);
+ expect(nestedDOs![2].getAttribute('name')).to.eql('t');
+ });
+
+ it('which return an empty array if the DoType cannot be found', async () => {
+ element = await fixture(html` DOType[id="Dummy.LLN0.Mod"] > SDO[name="sdoName2"]')}
+ >`);
+
+ const nestedDOs = element['getDAElements']();
+ expect(nestedDOs).to.be.empty;
+ });
+
+ it('which return an empty array if a DO doesn\t have child DA\'s.', async () => {
+ element = await fixture(html` DOType[id="Dummy.LLN0.Mod"] > SDO[name="sdoName3"]')}
+ >`);
+
+ const nestedDOs = element['getDOElements']();
+ expect(nestedDOs).to.be.empty;
+ });
+ });
+
+ describe('has a getInstanceDOElement function ', () => {
+ it('which return a DOI when a DO has a valid instance element.', async () => {
+ element = await fixture(html` LNodeType[id="Dummy.CSWIwithoutCtlModel"] > DO[name="Pos"]')}
+ .instanceElement=${validSCL.querySelector(
+ 'IED[name="IED1"] > AccessPoint[name="P1"] > Server > LDevice[inst="CircuitBreaker_CB1"] > LN[lnClass="CSWI"] > DOI[name="Pos"]')}
+ >`);
+
+ const sdo = validSCL.querySelector('DataTypeTemplates > DOType[id="Dummy.CSWI.Pos2"] > SDO[name="anotherPosDo"]')
+
+ const doi = element['getInstanceDOElement'](sdo!);
+ expect(doi).to.not.be.null;
+ expect(doi?.tagName).to.eql('SDI');
+ expect(doi?.getAttribute('name')).to.eql('anotherPosDo');
+ });
+
+ it('which returns null if there\'s no SDI available within a DOI.', async () => {
+ element = await fixture(html` LNodeType[id="Dummy.CSWIwithoutCtlModel"] > DO[name="Pos"]')}
+ .instanceElement=${validSCL.querySelector(
+ 'IED[name="IED1"] > AccessPoint[name="P1"] > Server > LDevice[inst="CircuitBreaker_CB1"] > LN[lnClass="CSWI"] > DOI[name="Pos"]')}
+ >`);
+
+ const sdo = validSCL.querySelector('DataTypeTemplates > DOType[id="Dummy.CSWI.Pos2"] > SDO[name="someQualityThing"]')
+
+ const doi = element['getInstanceDOElement'](sdo!);
+ expect(doi).to.be.null;
+ });
+
+ it('which returns null if no root DOI is available.', async () => {
+ element = await fixture(html` LNodeType[id="Dummy.CSWIwithoutCtlModel"] > DO[name="Pos"]')}
+ >`);
+
+ const sdo = validSCL.querySelector('DataTypeTemplates > DOType[id="Dummy.CSWI.Pos2"] > SDO[name="someQualityThing"]')
+
+ const doi = element['getInstanceDOElement'](sdo!);
+ expect(doi).to.be.null;
+ });
+ });
+
+ describe('has a getInstanceDAElement function ', () => {
+ it('which return a DAI when a DA has a valid instance element.', async () => {
+ element = await fixture(html` LNodeType[id="Dummy.CSWIwithoutCtlModel"] > DO[name="Pos"]')}
+ .instanceElement=${validSCL.querySelector(
+ 'IED[name="IED1"] > AccessPoint[name="P1"] > Server > LDevice[inst="CircuitBreaker_CB1"] > LN[lnClass="CSWI"] > DOI[name="Pos"]')}
+ >`);
+
+ const da = validSCL.querySelector('DataTypeTemplates > DOType[id="Dummy.CSWI.Pos2"] > DA[name="ctlModel"]')
+
+ const dai = element['getInstanceDAElement'](da!);
+ expect(dai).to.not.be.null;
+ expect(dai?.tagName).to.eql('DAI');
+ expect(dai?.getAttribute('name')).to.eql('ctlModel');
+ });
+
+ it('which returns null if there\'s no DAI available within a DOI.', async () => {
+ element = await fixture(html` LNodeType[id="Dummy.CSWIwithoutCtlModel"] > DO[name="Pos"]')}
+ .instanceElement=${validSCL.querySelector(
+ 'IED[name="IED1"] > AccessPoint[name="P1"] > Server > LDevice[inst="CircuitBreaker_CB1"] > LN[lnClass="CSWI"] > DOI[name="Pos"]')}
+ >`);
+
+ const da = validSCL.querySelector('DataTypeTemplates > DOType[id="Dummy.CSWI.Pos2"] > DA[name="d"]')
+
+ const dai = element['getInstanceDAElement'](da!);
+ expect(dai).to.be.null;
+ });
+
+ it('which returns null if no root DOI is available.', async () => {
+ element = await fixture(html` LNodeType[id="Dummy.CSWIwithoutCtlModel"] > DO[name="Pos"]')}
+ >`);
+
+ const da = validSCL.querySelector('DataTypeTemplates > DOType[id="Dummy.CSWI.Pos2"] > DA[name="d"]')
+
+ const dai = element['getInstanceDAElement'](da!);
+ expect(dai).to.be.null;
+ });
+ });
});
diff --git a/test/unit/editors/ied/ln-container.test.ts b/test/unit/editors/ied/ln-container.test.ts
index a9917ea72..f3345174e 100644
--- a/test/unit/editors/ied/ln-container.test.ts
+++ b/test/unit/editors/ied/ln-container.test.ts
@@ -105,6 +105,15 @@ describe('ln-container', () => {
const nestedDOs = element['getDOElements']();
expect(nestedDOs).to.be.empty;
});
+
+ it('which return an empty array if the LNodeType of a LN doesn\'t exist.', async () => {
+ element = await fixture(html``);
+
+ const nestedDOs = element['getDOElements']();
+ expect(nestedDOs).to.be.empty;
+ });
});
describe('has a getInstanceElement function ', () => {