@@ -3,7 +3,7 @@ import { expect } from '@open-wc/testing';
3
3
import { createMissingIEDNameSubscriberInfo } from '../../../src/menu/SubscriberInfo.js' ;
4
4
import { Create , isCreate , SimpleAction } from '../../../src/foundation.js' ;
5
5
6
- describe ( 'SubscriberInfo ' , ( ) => {
6
+ describe ( 'menu plugin adding subscriber info ' , ( ) => {
7
7
describe ( 'for Edition2 and higher files' , ( ) => {
8
8
let doc : Document ;
9
9
let actions : SimpleAction [ ] ;
@@ -15,11 +15,11 @@ describe('SubscriberInfo', () => {
15
15
actions = createMissingIEDNameSubscriberInfo ( doc ) ;
16
16
} ) ;
17
17
18
- it ( 'creates two SimpleActions ' , ( ) => {
19
- expect ( actions . length ) . to . equal ( 3 ) ;
18
+ it ( 'does create one action per necessary IEDName creation ' , ( ) => {
19
+ expect ( actions . length ) . to . equal ( 4 ) ;
20
20
} ) ;
21
21
22
- it ( 'the first writes the correct IEDName element' , ( ) => {
22
+ it ( 'creates correct IEDName element referencing LN0 element' , ( ) => {
23
23
expect ( actions [ 0 ] ) . to . satisfy ( isCreate ) ;
24
24
expect (
25
25
( < Element > ( < Create > actions [ 0 ] ) . new . element ) . getAttribute ( 'apRef' )
@@ -32,32 +32,34 @@ describe('SubscriberInfo', () => {
32
32
) . to . equal ( '' ) ;
33
33
expect (
34
34
( < Element > ( < Create > actions [ 0 ] ) . new . element ) . getAttribute ( 'lnClass' )
35
- ) . to . equal ( 'XSWI ' ) ;
35
+ ) . to . equal ( 'LLN0 ' ) ;
36
36
expect (
37
37
( < Element > ( < Create > actions [ 0 ] ) . new . element ) . getAttribute ( 'lnInst' )
38
- ) . to . equal ( '1' ) ;
38
+ ) . to . equal ( null ) ;
39
39
expect ( ( < Create > actions [ 0 ] ) . new . element . textContent ) . to . equal ( 'IED2' ) ;
40
40
} ) ;
41
- it ( 'the second writes the correct IEDName element' , ( ) => {
41
+
42
+ it ( 'creates correct IEDName element referencing LN element' , ( ) => {
42
43
expect ( actions [ 1 ] ) . to . satisfy ( isCreate ) ;
43
44
expect (
44
45
( < Element > ( < Create > actions [ 1 ] ) . new . element ) . getAttribute ( 'apRef' )
45
46
) . to . equal ( 'P1' ) ;
46
47
expect (
47
48
( < Element > ( < Create > actions [ 1 ] ) . new . element ) . getAttribute ( 'ldInst' )
48
- ) . to . equal ( 'Disconnectors ' ) ;
49
+ ) . to . equal ( 'CBSW ' ) ;
49
50
expect (
50
51
( < Element > ( < Create > actions [ 1 ] ) . new . element ) . getAttribute ( 'prefix' )
51
- ) . to . equal ( 'DC ' ) ;
52
+ ) . to . equal ( '' ) ;
52
53
expect (
53
54
( < Element > ( < Create > actions [ 1 ] ) . new . element ) . getAttribute ( 'lnClass' )
54
- ) . to . equal ( 'CSWI ' ) ;
55
+ ) . to . equal ( 'XSWI ' ) ;
55
56
expect (
56
57
( < Element > ( < Create > actions [ 1 ] ) . new . element ) . getAttribute ( 'lnInst' )
57
58
) . to . equal ( '1' ) ;
58
- expect ( ( < Create > actions [ 1 ] ) . new . element . textContent ) . to . equal ( 'IED1 ' ) ;
59
+ expect ( ( < Create > actions [ 1 ] ) . new . element . textContent ) . to . equal ( 'IED2 ' ) ;
59
60
} ) ;
60
- it ( 'the third writes the correct IEDName element' , ( ) => {
61
+
62
+ it ( 'creates correct IEDName element referencing LN element' , ( ) => {
61
63
expect ( actions [ 2 ] ) . to . satisfy ( isCreate ) ;
62
64
expect (
63
65
( < Element > ( < Create > actions [ 2 ] ) . new . element ) . getAttribute ( 'apRef' )
@@ -67,15 +69,35 @@ describe('SubscriberInfo', () => {
67
69
) . to . equal ( 'Disconnectors' ) ;
68
70
expect (
69
71
( < Element > ( < Create > actions [ 2 ] ) . new . element ) . getAttribute ( 'prefix' )
70
- ) . to . equal ( '' ) ;
72
+ ) . to . equal ( 'DC ' ) ;
71
73
expect (
72
74
( < Element > ( < Create > actions [ 2 ] ) . new . element ) . getAttribute ( 'lnClass' )
73
75
) . to . equal ( 'CSWI' ) ;
74
76
expect (
75
77
( < Element > ( < Create > actions [ 2 ] ) . new . element ) . getAttribute ( 'lnInst' )
76
- ) . to . equal ( '2 ' ) ;
78
+ ) . to . equal ( '1 ' ) ;
77
79
expect ( ( < Create > actions [ 2 ] ) . new . element . textContent ) . to . equal ( 'IED1' ) ;
78
80
} ) ;
81
+
82
+ it ( 'creates correct IEDName element referencing LN element' , ( ) => {
83
+ expect ( actions [ 3 ] ) . to . satisfy ( isCreate ) ;
84
+ expect (
85
+ ( < Element > ( < Create > actions [ 3 ] ) . new . element ) . getAttribute ( 'apRef' )
86
+ ) . to . equal ( 'P1' ) ;
87
+ expect (
88
+ ( < Element > ( < Create > actions [ 3 ] ) . new . element ) . getAttribute ( 'ldInst' )
89
+ ) . to . equal ( 'Disconnectors' ) ;
90
+ expect (
91
+ ( < Element > ( < Create > actions [ 3 ] ) . new . element ) . getAttribute ( 'prefix' )
92
+ ) . to . equal ( '' ) ;
93
+ expect (
94
+ ( < Element > ( < Create > actions [ 3 ] ) . new . element ) . getAttribute ( 'lnClass' )
95
+ ) . to . equal ( 'CSWI' ) ;
96
+ expect (
97
+ ( < Element > ( < Create > actions [ 3 ] ) . new . element ) . getAttribute ( 'lnInst' )
98
+ ) . to . equal ( '2' ) ;
99
+ expect ( ( < Create > actions [ 3 ] ) . new . element . textContent ) . to . equal ( 'IED1' ) ;
100
+ } ) ;
79
101
} ) ;
80
102
81
103
describe ( 'for Edition1 files' , ( ) => {
@@ -89,21 +111,21 @@ describe('SubscriberInfo', () => {
89
111
actions = createMissingIEDNameSubscriberInfo ( doc ) ;
90
112
} ) ;
91
113
92
- it ( 'creates two SimpleActions ' , ( ) => {
114
+ it ( 'does create one action per necessary IEDName creation ' , ( ) => {
93
115
expect ( actions . length ) . to . equal ( 2 ) ;
94
116
} ) ;
95
117
96
- it ( 'the first writing correct IEDName element' , ( ) => {
118
+ it ( 'creates correct IEDName element' , ( ) => {
97
119
expect ( actions [ 0 ] ) . to . satisfy ( isCreate ) ;
98
120
expect ( ( < Create > actions [ 0 ] ) . new . element . textContent ) . to . equal ( 'IED1' ) ;
99
121
} ) ;
100
122
101
- it ( 'the second writing correct IEDName element' , ( ) => {
123
+ it ( 'creates correct IEDName element' , ( ) => {
102
124
expect ( actions [ 1 ] ) . to . satisfy ( isCreate ) ;
103
125
expect ( ( < Create > actions [ 1 ] ) . new . element . textContent ) . to . equal ( 'IED1' ) ;
104
126
} ) ;
105
127
106
- it ( 'not writing Edition2 attributes into the IEDName element' , ( ) => {
128
+ it ( 'does not add Edition2 attributes into the IEDName element' , ( ) => {
107
129
actions . forEach ( action => {
108
130
expect ( ( < Element > ( < Create > action ) . new . element ) . getAttribute ( 'apRef' ) ) . to
109
131
. be . null ;
0 commit comments