@@ -290,28 +290,28 @@ describe('opensearch reducer actions', () => {
290
290
{ alias : 'alias1' , index : 'index1' } ,
291
291
{ alias : 'alias2' , index : 'index2' } ,
292
292
] ;
293
-
293
+
294
294
httpMockedClient . get = jest
295
295
. fn ( )
296
296
. mockResolvedValue ( { ok : true , response : { indices, aliases } } ) ;
297
-
297
+
298
298
await store . dispatch ( getIndicesAndAliases ( ) ) ;
299
299
const actions = store . getActions ( ) ;
300
-
300
+
301
301
expect ( actions [ 0 ] . type ) . toBe ( 'opensearch/GET_INDICES_AND_ALIASES_REQUEST' ) ;
302
302
expect ( reducer ( initialState , actions [ 0 ] ) ) . toEqual ( {
303
303
...initialState ,
304
304
requesting : true ,
305
305
} ) ;
306
-
306
+
307
307
expect ( actions [ 1 ] . type ) . toBe ( 'opensearch/GET_INDICES_AND_ALIASES_SUCCESS' ) ;
308
308
expect ( reducer ( initialState , actions [ 1 ] ) ) . toEqual ( {
309
309
...initialState ,
310
310
requesting : false ,
311
311
indices,
312
312
aliases,
313
313
} ) ;
314
-
314
+
315
315
expect ( httpMockedClient . get ) . toHaveBeenCalledWith (
316
316
`..${ BASE_NODE_API_PATH } /_indices_and_aliases` ,
317
317
{
@@ -328,28 +328,28 @@ describe('opensearch reducer actions', () => {
328
328
{ alias : 'alias1' , index : 'index1' } ,
329
329
{ alias : 'alias2' , index : 'index2' } ,
330
330
] ;
331
-
331
+
332
332
httpMockedClient . get = jest
333
333
. fn ( )
334
334
. mockResolvedValue ( { ok : true , response : { indices, aliases } } ) ;
335
-
335
+
336
336
await store . dispatch ( getIndicesAndAliases ( '' , '' , 'cluster-2,cluster-3' ) ) ;
337
337
const actions = store . getActions ( ) ;
338
-
338
+
339
339
expect ( actions [ 0 ] . type ) . toBe ( 'opensearch/GET_INDICES_AND_ALIASES_REQUEST' ) ;
340
340
expect ( reducer ( initialState , actions [ 0 ] ) ) . toEqual ( {
341
341
...initialState ,
342
342
requesting : true ,
343
343
} ) ;
344
-
344
+
345
345
expect ( actions [ 1 ] . type ) . toBe ( 'opensearch/GET_INDICES_AND_ALIASES_SUCCESS' ) ;
346
346
expect ( reducer ( initialState , actions [ 1 ] ) ) . toEqual ( {
347
347
...initialState ,
348
348
requesting : false ,
349
349
indices,
350
350
aliases,
351
351
} ) ;
352
-
352
+
353
353
expect ( httpMockedClient . get ) . toHaveBeenCalledWith (
354
354
`..${ BASE_NODE_API_PATH } /_indices_and_aliases` ,
355
355
{
@@ -366,26 +366,26 @@ describe('opensearch reducer actions', () => {
366
366
ok : false ,
367
367
error : 'Something went wrong' ,
368
368
} ) ;
369
-
369
+
370
370
try {
371
371
await store . dispatch ( getIndicesAndAliases ( ) ) ;
372
372
} catch ( e ) {
373
373
const actions = store . getActions ( ) ;
374
-
374
+
375
375
expect ( actions [ 0 ] . type ) . toBe ( 'opensearch/GET_INDICES_AND_ALIASES_REQUEST' ) ;
376
376
expect ( reducer ( initialState , actions [ 0 ] ) ) . toEqual ( {
377
377
...initialState ,
378
378
requesting : true ,
379
379
errorMessage : '' ,
380
380
} ) ;
381
-
381
+
382
382
expect ( actions [ 1 ] . type ) . toBe ( 'opensearch/GET_INDICES_AND_ALIASES_FAILURE' ) ;
383
383
expect ( reducer ( initialState , actions [ 1 ] ) ) . toEqual ( {
384
384
...initialState ,
385
385
requesting : false ,
386
386
errorMessage : 'Something went wrong' ,
387
387
} ) ;
388
-
388
+
389
389
expect ( httpMockedClient . get ) . toHaveBeenCalledWith (
390
390
`..${ BASE_NODE_API_PATH } /_indices_and_aliases` ,
391
391
{
@@ -405,65 +405,65 @@ describe('opensearch reducer actions', () => {
405
405
{ cluster : 'cluster1' , status : 'green' } ,
406
406
{ cluster : 'cluster2' , status : 'yellow' } ,
407
407
] ;
408
-
408
+
409
409
httpMockedClient . get = jest
410
410
. fn ( )
411
411
. mockResolvedValue ( { ok : true , response : { clusters } } ) ;
412
-
412
+
413
413
await store . dispatch ( getClustersInfo ( ) ) ;
414
414
const actions = store . getActions ( ) ;
415
-
415
+
416
416
expect ( actions [ 0 ] . type ) . toBe ( 'opensearch/GET_CLUSTERS_INFO_REQUEST' ) ;
417
417
expect ( reducer ( initialState , actions [ 0 ] ) ) . toEqual ( {
418
418
...initialState ,
419
419
requesting : true ,
420
420
errorMessage : '' ,
421
421
} ) ;
422
-
422
+
423
423
expect ( actions [ 1 ] . type ) . toBe ( 'opensearch/GET_CLUSTERS_INFO_SUCCESS' ) ;
424
424
expect ( reducer ( initialState , actions [ 1 ] ) ) . toEqual ( {
425
425
...initialState ,
426
426
requesting : false ,
427
427
clusters,
428
428
} ) ;
429
-
429
+
430
430
expect ( httpMockedClient . get ) . toHaveBeenCalledWith (
431
431
`..${ BASE_NODE_API_PATH } /_remote/info`
432
432
) ;
433
433
} ) ;
434
434
test ( 'should invoke [REQUEST, FAILURE]' , async ( ) => {
435
435
const errorMessage = 'Something went wrong' ;
436
-
436
+
437
437
httpMockedClient . get = jest . fn ( ) . mockRejectedValue ( {
438
438
ok : false ,
439
439
error : errorMessage ,
440
440
} ) ;
441
-
441
+
442
442
try {
443
443
await store . dispatch ( getClustersInfo ( ) ) ;
444
444
} catch ( e ) {
445
445
const actions = store . getActions ( ) ;
446
-
446
+
447
447
expect ( actions [ 0 ] . type ) . toBe ( 'opensearch/GET_CLUSTERS_INFO_REQUEST' ) ;
448
448
expect ( reducer ( initialState , actions [ 0 ] ) ) . toEqual ( {
449
449
...initialState ,
450
450
requesting : true ,
451
451
errorMessage : '' ,
452
452
} ) ;
453
-
453
+
454
454
expect ( actions [ 1 ] . type ) . toBe ( 'opensearch/GET_CLUSTERS_INFO_FAILURE' ) ;
455
455
expect ( reducer ( initialState , actions [ 1 ] ) ) . toEqual ( {
456
456
...initialState ,
457
457
requesting : false ,
458
458
errorMessage,
459
459
} ) ;
460
-
460
+
461
461
expect ( httpMockedClient . get ) . toHaveBeenCalledWith (
462
462
`..${ BASE_NODE_API_PATH } /_remote/info`
463
463
) ;
464
464
}
465
465
} ) ;
466
466
} ) ;
467
467
468
- describe ( 'getPrioritizedIndices' , ( ) => { } ) ;
468
+ describe ( 'getPrioritizedIndices' , ( ) => { } ) ;
469
469
} ) ;
0 commit comments