Skip to content

Commit

Permalink
test(wizards/lnode): better test unique lnInst selection
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobVogelsang committed May 24, 2022
1 parent 280c82b commit b794f01
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
7 changes: 6 additions & 1 deletion test/testfiles/lnodewizard.scd
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@
<LNode iedName="None" lnClass="XCBR" lnInst="1" lnType="Dummy.XCBR1"/>
<LNode iedName="None" lnClass="CILO" lnInst="1" lnType="Dummy.CILO"/>
</SubFunction>
<SubFunction name="disconnector" type="DIS"/>
<SubFunction name="disconnector" type="DIS">
<LNode iedName="None" lnClass="CSWI" lnInst="1" lnType="Dummy.CILO"/>
<LNode iedName="None" lnClass="CSWI" lnInst="3" lnType="Dummy.CILO"/>
<LNode iedName="None" lnClass="CSWI" lnInst="5" lnType="Dummy.CILO"/>
<LNode iedName="None" lnClass="CILO" lnInst="1" lnType="Dummy.CILO"/>
</SubFunction>
</Function>
</Bay>
</VoltageLevel>
Expand Down
12 changes: 6 additions & 6 deletions test/unit/wizards/lnode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,16 @@ describe('Wizards for LNode element', () => {
});

it('does set iedName, lnCalss, lnInst and lnType', async () => {
listItems[4].selected = true;
listItems[2].selected = true;

await primaryAction.click();

expect(actionEvent).to.have.be.calledOnce;
const action = <Create>actionEvent.args[0][0].detail.action;
expect(action.new.element).to.have.attribute('iedName', 'None');
expect(action.new.element).to.have.attribute('lnClass', 'CILO');
expect(action.new.element).to.have.attribute('lnClass', 'XCBR');
expect(action.new.element).to.have.attribute('lnInst', '1');
expect(action.new.element).to.have.attribute('lnType', 'Dummy.CILO');
expect(action.new.element).to.have.attribute('lnType', 'Dummy.XCBR1');
});

it('does not set ldInst and prefix', async () => {
Expand All @@ -209,7 +209,7 @@ describe('Wizards for LNode element', () => {

expect(actionEvent).to.have.be.calledOnce;
const action = <Create>actionEvent.args[0][0].detail.action;
expect(action.new.element).to.have.attribute('lnInst', '1');
expect(action.new.element).to.have.attribute('lnInst', '2');
});

it('makes sure that lnInst is unique if several LNodeType with same lnClass are selected', async () => {
Expand All @@ -221,8 +221,8 @@ describe('Wizards for LNode element', () => {
expect(actionEvent).to.have.be.calledTwice;
const action1 = <Create>actionEvent.args[0][0].detail.action;
const action2 = <Create>actionEvent.args[1][0].detail.action;
expect(action1.new.element).to.have.attribute('lnInst', '1');
expect(action2.new.element).to.have.attribute('lnInst', '2');
expect(action1.new.element).to.have.attribute('lnInst', '2');
expect(action2.new.element).to.have.attribute('lnInst', '4');
});

it('does add empty string to LNode with lnClass LLN0', async () => {
Expand Down

0 comments on commit b794f01

Please sign in to comment.