@@ -32,108 +32,4 @@ describe('Unit | Certification | Configuration | Domain | Models | Center', func
32
32
expect ( error ) . to . be . an . instanceOf ( EntityValidationError ) ;
33
33
} ) ;
34
34
} ) ;
35
-
36
- context ( '#isInWhitelist' , function ( ) {
37
- let originalEnvValueWhitelist ;
38
-
39
- beforeEach ( function ( ) {
40
- originalEnvValueWhitelist = config . features . pixCertifScoBlockedAccessWhitelist ;
41
- config . features . pixCertifScoBlockedAccessWhitelist = [ ] ;
42
- } ) ;
43
-
44
- afterEach ( function ( ) {
45
- config . features . pixCertifScoBlockedAccessWhitelist = originalEnvValueWhitelist ;
46
- } ) ;
47
-
48
- it ( 'should consider centers other than SCO as always whitelisted' , function ( ) {
49
- // given
50
- config . features . pixCertifScoBlockedAccessWhitelist = [ 'hello' ] ;
51
- const center = new Center ( {
52
- id : 12 ,
53
- type : CenterTypes . PRO ,
54
- externalId : 'hello' ,
55
- } ) ;
56
- // when
57
- const isInWhitelist = center . isInWhitelist ( ) ;
58
-
59
- // then
60
- expect ( isInWhitelist ) . to . be . true ;
61
- } ) ;
62
- context ( 'when center is SCO' , function ( ) {
63
- it ( 'should consider blank externalId as not whitelisted' , function ( ) {
64
- // given
65
- const center = new Center ( {
66
- id : 12 ,
67
- type : CenterTypes . SCO ,
68
- externalId : ' ' ,
69
- } ) ;
70
- // when
71
- const isInWhitelist = center . isInWhitelist ( ) ;
72
-
73
- // then
74
- expect ( isInWhitelist ) . to . be . false ;
75
- } ) ;
76
-
77
- it ( 'should consider center without externalId as not whitelisted' , function ( ) {
78
- // given
79
- const center = new Center ( {
80
- id : 12 ,
81
- type : CenterTypes . SCO ,
82
- externalId : undefined ,
83
- } ) ;
84
- // when
85
- const isInWhitelist = center . isInWhitelist ( ) ;
86
-
87
- // then
88
- expect ( isInWhitelist ) . to . be . false ;
89
- } ) ;
90
-
91
- it ( 'should consider center in whitelist as whitelisted' , function ( ) {
92
- // given
93
- const externalId = 'WHITELISTED' ;
94
- config . features . pixCertifScoBlockedAccessWhitelist = [ externalId ] ;
95
- const center = new Center ( {
96
- id : 12 ,
97
- type : CenterTypes . SCO ,
98
- externalId : externalId ,
99
- } ) ;
100
- // when
101
- const isInWhitelist = center . isInWhitelist ( ) ;
102
-
103
- // then
104
- expect ( isInWhitelist ) . to . be . true ;
105
- } ) ;
106
-
107
- it ( 'should consider center NOT in whitelist as NOT whitelisted' , function ( ) {
108
- // given
109
- config . features . pixCertifScoBlockedAccessWhitelist = [ 'WHITELISTED' ] ;
110
- const center = new Center ( {
111
- id : 12 ,
112
- type : CenterTypes . SCO ,
113
- externalId : 'not_whitelisted' ,
114
- } ) ;
115
- // when
116
- const isInWhitelist = center . isInWhitelist ( ) ;
117
-
118
- // then
119
- expect ( isInWhitelist ) . to . be . false ;
120
- } ) ;
121
-
122
- it ( 'should not be case sensitive on externalId' , function ( ) {
123
- // given
124
- // config is already uppercased + trimmed
125
- config . features . pixCertifScoBlockedAccessWhitelist = [ 'WHITELISTED12' ] ;
126
- const center = new Center ( {
127
- id : 12 ,
128
- type : CenterTypes . SCO ,
129
- externalId : 'whiteLISTed12' ,
130
- } ) ;
131
- // when
132
- const isInWhitelist = center . isInWhitelist ( ) ;
133
-
134
- // then
135
- expect ( isInWhitelist ) . to . be . true ;
136
- } ) ;
137
- } ) ;
138
- } ) ;
139
35
} ) ;
0 commit comments