@@ -13,7 +13,7 @@ function findElements(str: string, selector: string): Element[] {
1313 return Array . from (
1414 new DOMParser ( )
1515 . parseFromString ( str , "application/xml" )
16- . querySelectorAll ( selector ) ,
16+ . querySelectorAll ( selector )
1717 ) ;
1818}
1919
@@ -70,7 +70,7 @@ describe("Function allowing to unsubscribe multiple external references", () =>
7070 it ( "does not remove ICT defined Ed2.1 attributes" , ( ) => {
7171 const extRef = findElement (
7272 laterBindingExtRefs ,
73- 'ExtRef[intAddr="someOtherIntAddr"]' ,
73+ 'ExtRef[intAddr="someOtherIntAddr"]'
7474 ) ! ;
7575 const edits = unsubscribe ( [ extRef ] ) ;
7676
@@ -89,16 +89,15 @@ describe("Function allowing to unsubscribe multiple external references", () =>
8989 it ( "per default remove subscription LGOS supervision as well" , ( ) => {
9090 const extRefs = findElements (
9191 withSubscriptionSupervision ,
92- 'ExtRef[srcCBName="someGse"], ExtRef[srcCBName="someGse2"]' ,
92+ 'ExtRef[srcCBName="someGse"], ExtRef[srcCBName="someGse2"]'
9393 ) ;
9494 const edits = unsubscribe ( extRefs ) ;
95- const doi = extRefs [ 0 ] . ownerDocument . querySelector (
96- 'LN[lnClass="LGOS"][inst="1"] > DOI' ,
95+ const val = extRefs [ 0 ] . ownerDocument . querySelector (
96+ 'LN[lnClass="LGOS"][inst="1"] > DOI[name="GoCBRef"] > DAI[name="setSrcRef"] > Val'
9797 ) ;
98- const ln = extRefs [ 0 ] . ownerDocument . querySelector (
99- 'LN[lnClass="LGOS"][inst="2"]' ,
98+ const val2 = extRefs [ 0 ] . ownerDocument . querySelector (
99+ 'LN[lnClass="LGOS"][inst="2"] > DOI[name="GoCBRef"] > DAI[name="setSrcRef"] > Val'
100100 ) ;
101-
102101 expect ( edits . length ) . to . equal ( 5 ) ;
103102 expect ( edits [ 0 ] ) . to . satisfies ( isRemove ) ;
104103 expect ( ( edits [ 0 ] as Remove ) . node ) . to . equal ( extRefs [ 0 ] ) ;
@@ -107,15 +106,15 @@ describe("Function allowing to unsubscribe multiple external references", () =>
107106 expect ( edits [ 2 ] ) . to . satisfies ( isUpdate ) ;
108107 expect ( ( edits [ 2 ] as Update ) . element ) . to . equal ( extRefs [ 2 ] ) ;
109108 expect ( edits [ 3 ] ) . to . satisfies ( isRemove ) ;
110- expect ( ( edits [ 3 ] as Remove ) . node ) . to . equal ( doi ) ;
109+ expect ( ( edits [ 3 ] as Remove ) . node ) . to . equal ( val ! . firstChild ) ;
111110 expect ( edits [ 4 ] ) . to . satisfies ( isRemove ) ;
112- expect ( ( edits [ 4 ] as Remove ) . node ) . to . equal ( ln ) ;
111+ expect ( ( edits [ 4 ] as Remove ) . node ) . to . equal ( val2 ! . firstChild ) ;
113112 } ) ;
114113
115114 it ( "with ignoreSupervision do not remove subscription LGOS supervision" , ( ) => {
116115 const extRefs = findElements (
117116 withSubscriptionSupervision ,
118- 'ExtRef[srcCBName="someGse"], ExtRef[srcCBName="someGse2"]' ,
117+ 'ExtRef[srcCBName="someGse"], ExtRef[srcCBName="someGse2"]'
119118 ) ;
120119 const edits = unsubscribe ( extRefs , { ignoreSupervision : true } ) ;
121120
@@ -131,7 +130,7 @@ describe("Function allowing to unsubscribe multiple external references", () =>
131130 it ( "does not remove subscription supervision with remaining connections" , ( ) => {
132131 const extRef = findElement (
133132 withSubscriptionSupervision ,
134- 'ExtRef[srcCBName="someGse"]' ,
133+ 'ExtRef[srcCBName="someGse"]'
135134 ) ! ;
136135 const edits = unsubscribe ( [ extRef ] ) ;
137136
@@ -143,7 +142,7 @@ describe("Function allowing to unsubscribe multiple external references", () =>
143142 it ( "does not remove subscription supervision without missing object reference" , ( ) => {
144143 const extRef = findElement (
145144 withSubscriptionSupervision ,
146- 'ExtRef[srcCBName="someGse3"]' ,
145+ 'ExtRef[srcCBName="someGse3"]'
147146 ) ! ;
148147 const edits = unsubscribe ( [ extRef ] ) ;
149148
@@ -155,10 +154,10 @@ describe("Function allowing to unsubscribe multiple external references", () =>
155154 it ( "makes sure to remove subscription LSVS supervision as well" , ( ) => {
156155 const extRefs = findElements (
157156 withSubscriptionSupervision ,
158- 'ExtRef[srcCBName="someSmv"]' ,
157+ 'ExtRef[srcCBName="someSmv"]'
159158 ) ;
160- const doi = extRefs [ 0 ] . ownerDocument . querySelector (
161- 'LN[lnClass="LSVS"][inst="1"] > DOI' ,
159+ const val = extRefs [ 0 ] . ownerDocument . querySelector (
160+ 'LN[lnClass="LSVS"][inst="1"] > DOI[name="SvCBRef"] > DAI[name="setSrcRef"] > Val'
162161 ) ;
163162 const edits = unsubscribe ( extRefs ) ;
164163
@@ -170,13 +169,13 @@ describe("Function allowing to unsubscribe multiple external references", () =>
170169 expect ( edits [ 2 ] ) . to . satisfies ( isRemove ) ;
171170 expect ( ( edits [ 2 ] as Remove ) . node ) . to . equal ( extRefs [ 1 ] . parentElement ) ;
172171 expect ( edits [ 3 ] ) . to . satisfies ( isRemove ) ;
173- expect ( ( edits [ 3 ] as Remove ) . node ) . to . equal ( doi ) ;
172+ expect ( ( edits [ 3 ] as Remove ) . node ) . to . equal ( val ?. firstChild ) ;
174173 } ) ;
175174
176175 it ( "with ignoreSupervision do not remove subscription LGOS supervision" , ( ) => {
177176 const extRefs = findElements (
178177 withSubscriptionSupervision ,
179- 'ExtRef[srcCBName="someSmv"]' ,
178+ 'ExtRef[srcCBName="someSmv"]'
180179 ) ;
181180 const edits = unsubscribe ( extRefs , { ignoreSupervision : true } ) ;
182181
@@ -192,7 +191,7 @@ describe("Function allowing to unsubscribe multiple external references", () =>
192191 it ( "with pServT present, serviceType is removed" , ( ) => {
193192 const extRefs = findElements (
194193 laterBindingExtRefs ,
195- 'ExtRef[intAddr="someOtherIntAddr"]' ,
194+ 'ExtRef[intAddr="someOtherIntAddr"]'
196195 ) ;
197196 const edits = unsubscribe ( extRefs , { ignoreSupervision : true } ) ;
198197
@@ -204,14 +203,14 @@ describe("Function allowing to unsubscribe multiple external references", () =>
204203 it ( "without pServT, serviceType is not removed" , ( ) => {
205204 const extRefs = findElements (
206205 laterBindingExtRefs ,
207- 'ExtRef[intAddr="someIntAddr"]' ,
206+ 'ExtRef[intAddr="someIntAddr"]'
208207 ) [ 0 ] ;
209208 const edits = unsubscribe ( [ extRefs ] , { ignoreSupervision : true } ) ;
210209
211210 expect ( edits . length ) . to . equal ( 1 ) ;
212211 expect ( ( edits [ 0 ] as Update ) . element ) . to . equal ( extRefs ) ;
213212 expect ( ( edits [ 0 ] as Update ) . attributes ) . to . not . have . own . property (
214- "serviceType" ,
213+ "serviceType"
215214 ) ;
216215 } ) ;
217216} ) ;
0 commit comments