@@ -116,7 +116,7 @@ describe('ListWatchCache', () => {
116
116
] ,
117
117
} as V1NamespaceList ;
118
118
119
- var calls = 0 ;
119
+ let calls = 0 ;
120
120
const listFn : ListPromise < V1Namespace > = function ( ) : Promise < {
121
121
response : http . IncomingMessage ;
122
122
body : V1NamespaceList ;
@@ -144,11 +144,11 @@ describe('ListWatchCache', () => {
144
144
expect ( pathOut ) . to . equal ( '/some/path' ) ;
145
145
expect ( cache . list ( ) ) . to . deep . equal ( list ) ;
146
146
147
- expect ( cache . get ( 'name1' ) ) . to . equal ( list [ 0 ] ) ;
148
- expect ( cache . get ( 'name2' ) ) . to . equal ( list [ 1 ] ) ;
147
+ expect ( cache . get ( 'name1' , 'default' ) ) . to . equal ( list [ 0 ] ) ;
148
+ expect ( cache . get ( 'name2' , 'default' ) ) . to . equal ( list [ 1 ] ) ;
149
149
150
150
expect ( cache . list ( 'default' ) ) . to . deep . equal ( list ) ;
151
- expect ( cache . list ( 'non-existent' ) ) . to . be . undefined ;
151
+ expect ( cache . list ( 'non-existent' ) ) . to . deep . equal ( [ ] ) ;
152
152
153
153
watchHandler ( 'ADDED' , {
154
154
metadata : {
@@ -158,11 +158,11 @@ describe('ListWatchCache', () => {
158
158
} as V1Namespace ) ;
159
159
160
160
expect ( cache . list ( ) . length ) . to . equal ( 3 ) ;
161
- expect ( cache . get ( 'name3' ) ) . to . not . equal ( null ) ;
161
+ expect ( cache . get ( 'name3' , 'default' ) ) . to . not . equal ( null ) ;
162
162
163
163
expect ( cache . list ( 'default' ) . length ) . to . equal ( 2 ) ;
164
164
expect ( cache . list ( 'other' ) . length ) . to . equal ( 1 ) ;
165
- expect ( cache . list ( 'non-existent' ) ) . to . be . undefined ;
165
+ expect ( cache . list ( 'non-existent' ) ) . to . deep . equal ( [ ] ) ;
166
166
167
167
watchHandler ( 'MODIFIED' , {
168
168
metadata : {
@@ -172,7 +172,7 @@ describe('ListWatchCache', () => {
172
172
} as V1ObjectMeta ,
173
173
} as V1Namespace ) ;
174
174
expect ( cache . list ( ) . length ) . to . equal ( 3 ) ;
175
- const obj3 = cache . get ( 'name3' ) ;
175
+ const obj3 = cache . get ( 'name3' , 'other' ) ;
176
176
expect ( obj3 ) . to . not . equal ( null ) ;
177
177
if ( obj3 ) {
178
178
expect ( obj3 . metadata ! . name ) . to . equal ( 'name3' ) ;
@@ -186,7 +186,7 @@ describe('ListWatchCache', () => {
186
186
} as V1ObjectMeta ,
187
187
} as V1Namespace ) ;
188
188
expect ( cache . list ( ) . length ) . to . equal ( 2 ) ;
189
- expect ( cache . get ( 'name2' ) ) . to . equal ( undefined ) ;
189
+ expect ( cache . get ( 'name2' , 'default' ) ) . to . equal ( undefined ) ;
190
190
191
191
expect ( cache . list ( 'default' ) . length ) . to . equal ( 1 ) ;
192
192
expect ( cache . list ( 'other' ) . length ) . to . equal ( 1 ) ;
@@ -203,7 +203,7 @@ describe('ListWatchCache', () => {
203
203
await doneHandler ( error ) ;
204
204
expect ( cache . list ( ) . length , 'all namespace list' ) . to . equal ( 1 ) ;
205
205
expect ( cache . list ( 'default' ) . length , 'default namespace list' ) . to . equal ( 1 ) ;
206
- expect ( cache . list ( 'other' ) , 'other namespace list' ) . to . be . undefined ;
206
+ expect ( cache . list ( 'other' ) , 'other namespace list' ) . to . deep . equal ( [ ] ) ;
207
207
} ) ;
208
208
209
209
it ( 'should perform work as an informer' , async ( ) => {
@@ -635,8 +635,8 @@ describe('ListWatchCache', () => {
635
635
expect ( pathOut ) . to . equal ( '/some/path' ) ;
636
636
expect ( cache . list ( ) ) . to . deep . equal ( list ) ;
637
637
638
- expect ( cache . get ( 'name1' ) ) . to . equal ( list [ 0 ] ) ;
639
- expect ( cache . get ( 'name2' ) ) . to . equal ( list [ 1 ] ) ;
638
+ expect ( cache . get ( 'name1' , 'ns1' ) ) . to . equal ( list [ 0 ] ) ;
639
+ expect ( cache . get ( 'name2' , 'ns2' ) ) . to . equal ( list [ 1 ] ) ;
640
640
641
641
expect ( cache . list ( 'ns1' ) . length ) . to . equal ( 1 ) ;
642
642
expect ( cache . list ( 'ns1' ) [ 0 ] . metadata ! . name ) . to . equal ( 'name1' ) ;
0 commit comments