@@ -254,7 +254,7 @@ describe('GlobalWritesStore Store', function () {
254254 shouldAdvanceTime : true ,
255255 } ) ;
256256 const promise = store . dispatch ( createShardKey ( shardKeyData ) ) ;
257- expect ( store . getState ( ) . status ) . to . equal ( 'SUBMITTING_FOR_SHARDING' ) ;
257+ expect ( store . getState ( ) . isSubmittingForSharding ) . to . equal ( true ) ;
258258 mockManagedNamespace = true ;
259259 await promise ;
260260 expect ( store . getState ( ) . status ) . to . equal ( 'SHARDING' ) ;
@@ -264,6 +264,7 @@ describe('GlobalWritesStore Store', function () {
264264 clock . tick ( POLLING_INTERVAL ) ;
265265 await waitFor ( ( ) => {
266266 expect ( store . getState ( ) . status ) . to . equal ( 'SHARD_KEY_CORRECT' ) ;
267+ expect ( store . getState ( ) . isSubmittingForSharding ) . to . be . undefined ;
267268 } ) ;
268269 } ) ;
269270
@@ -283,7 +284,7 @@ describe('GlobalWritesStore Store', function () {
283284 shouldAdvanceTime : true ,
284285 } ) ;
285286 const promise = store . dispatch ( createShardKey ( shardKeyData ) ) ;
286- expect ( store . getState ( ) . status ) . to . equal ( 'SUBMITTING_FOR_SHARDING' ) ;
287+ expect ( store . getState ( ) . isSubmittingForSharding ) . to . equal ( true ) ;
287288 await promise ;
288289 expect ( store . getState ( ) . status ) . to . equal ( 'SHARDING' ) ;
289290
@@ -292,6 +293,7 @@ describe('GlobalWritesStore Store', function () {
292293 clock . tick ( POLLING_INTERVAL ) ;
293294 await waitFor ( ( ) => {
294295 expect ( store . getState ( ) . status ) . to . equal ( 'SHARDING_ERROR' ) ;
296+ expect ( store . getState ( ) . isSubmittingForSharding ) . to . be . undefined ;
295297 expect ( store . getState ( ) . shardingError ) . to . equal (
296298 `Failed to shard ${ NS } `
297299 ) ; // the original error text was: `before timestamp[01:02:03.456]Failed to shard ${NS}`
@@ -310,9 +312,10 @@ describe('GlobalWritesStore Store', function () {
310312
311313 // user tries to submit for sharding, but the request fails
312314 const promise = store . dispatch ( createShardKey ( shardKeyData ) ) ;
313- expect ( store . getState ( ) . status ) . to . equal ( 'SUBMITTING_FOR_SHARDING' ) ;
315+ expect ( store . getState ( ) . isSubmittingForSharding ) . to . equal ( true ) ;
314316 await promise ;
315317 expect ( store . getState ( ) . status ) . to . equal ( 'UNSHARDED' ) ;
318+ expect ( store . getState ( ) . isSubmittingForSharding ) . to . be . undefined ;
316319 } ) ;
317320
318321 it ( 'sharding -> valid shard key' , async function ( ) {
@@ -448,9 +451,7 @@ describe('GlobalWritesStore Store', function () {
448451 // user asks to resume geosharding
449452 const promise = store . dispatch ( resumeManagedNamespace ( ) ) ;
450453 mockManagedNamespace = true ;
451- expect ( store . getState ( ) . status ) . to . equal (
452- 'SUBMITTING_FOR_SHARDING_INCOMPLETE'
453- ) ;
454+ expect ( store . getState ( ) . isSubmittingForSharding ) . to . equal ( true ) ;
454455 await promise ;
455456
456457 // sharding
@@ -460,10 +461,11 @@ describe('GlobalWritesStore Store', function () {
460461 clock . tick ( POLLING_INTERVAL ) ;
461462 await waitFor ( ( ) => {
462463 expect ( store . getState ( ) . status ) . to . equal ( 'SHARD_KEY_CORRECT' ) ;
464+ expect ( store . getState ( ) . isSubmittingForSharding ) . to . be . undefined ;
463465 } ) ;
464466 } ) ;
465467
466- it ( 'incomplete setup -> sharding -> incomplete setup (request was cancelled)' , async function ( ) {
468+ it . only ( 'incomplete setup -> sharding -> incomplete setup (request was cancelled)' , async function ( ) {
467469 // initial state -> incomplete shardingSetup
468470 clock = sinon . useFakeTimers ( {
469471 shouldAdvanceTime : true ,
@@ -479,9 +481,7 @@ describe('GlobalWritesStore Store', function () {
479481
480482 // user asks to resume geosharding
481483 const promise = store . dispatch ( resumeManagedNamespace ( ) ) ;
482- expect ( store . getState ( ) . status ) . to . equal (
483- 'SUBMITTING_FOR_SHARDING_INCOMPLETE'
484- ) ;
484+ expect ( store . getState ( ) . isSubmittingForSharding ) . to . equal ( true ) ;
485485 await promise ;
486486
487487 // sharding
@@ -493,6 +493,8 @@ describe('GlobalWritesStore Store', function () {
493493 clock . tick ( POLLING_INTERVAL ) ;
494494 await waitFor ( ( ) => {
495495 expect ( store . getState ( ) . status ) . to . equal ( 'INCOMPLETE_SHARDING_SETUP' ) ;
496+ expect ( store . getState ( ) . isSubmittingForSharding ) . to . be . undefined ;
497+ expect ( store . getState ( ) . isCancellingSharding ) . to . be . undefined ;
496498 } ) ;
497499 } ) ;
498500
@@ -513,14 +515,13 @@ describe('GlobalWritesStore Store', function () {
513515
514516 // user asks to resume geosharding
515517 const promise = store . dispatch ( resumeManagedNamespace ( ) ) ;
516- expect ( store . getState ( ) . status ) . to . equal (
517- 'SUBMITTING_FOR_SHARDING_INCOMPLETE'
518- ) ;
518+ expect ( store . getState ( ) . isSubmittingForSharding ) . to . equal ( true ) ;
519519 await promise ;
520520
521521 // it failed
522522 await waitFor ( ( ) => {
523523 expect ( store . getState ( ) . status ) . to . equal ( 'INCOMPLETE_SHARDING_SETUP' ) ;
524+ expect ( store . getState ( ) . isSubmittingForSharding ) . to . be . undefined ;
524525 } ) ;
525526 } ) ;
526527
@@ -537,9 +538,10 @@ describe('GlobalWritesStore Store', function () {
537538
538539 // user asks to unmanage
539540 const promise = store . dispatch ( unmanageNamespace ( ) ) ;
540- expect ( store . getState ( ) . status ) . to . equal ( 'UNMANAGING_NAMESPACE' ) ;
541+ expect ( store . getState ( ) . isUnmanagingNamespace ) . to . equal ( true ) ;
541542 await promise ;
542543 expect ( store . getState ( ) . status ) . to . equal ( 'INCOMPLETE_SHARDING_SETUP' ) ;
544+ expect ( store . getState ( ) . isUnmanagingNamespace ) . to . be . undefined ;
543545 } ) ;
544546
545547 it ( 'valid shard key -> valid shard key (failed unmanage attempt)' , async function ( ) {
@@ -559,9 +561,10 @@ describe('GlobalWritesStore Store', function () {
559561 // user asks to unmanage
560562 mockFailure = true ;
561563 const promise = store . dispatch ( unmanageNamespace ( ) ) ;
562- expect ( store . getState ( ) . status ) . to . equal ( 'UNMANAGING_NAMESPACE' ) ;
564+ expect ( store . getState ( ) . isUnmanagingNamespace ) . to . equal ( true ) ;
563565 await promise ;
564566 expect ( store . getState ( ) . status ) . to . equal ( 'SHARD_KEY_CORRECT' ) ;
567+ expect ( store . getState ( ) . isUnmanagingNamespace ) . to . be . undefined ;
565568 } ) ;
566569
567570 context ( 'invalid and mismatching shard keys' , function ( ) {
@@ -654,11 +657,10 @@ describe('GlobalWritesStore Store', function () {
654657
655658 // user asks to unmanage
656659 const promise = store . dispatch ( unmanageNamespace ( ) ) ;
657- expect ( store . getState ( ) . status ) . to . equal (
658- 'UNMANAGING_NAMESPACE_MISMATCH'
659- ) ;
660+ expect ( store . getState ( ) . isUnmanagingNamespace ) . to . equal ( true ) ;
660661 await promise ;
661662 expect ( store . getState ( ) . status ) . to . equal ( 'INCOMPLETE_SHARDING_SETUP' ) ;
663+ expect ( store . getState ( ) . isUnmanagingNamespace ) . to . be . undefined ;
662664 } ) ;
663665 } ) ;
664666
@@ -707,7 +709,7 @@ describe('GlobalWritesStore Store', function () {
707709 // user submits the form
708710 const promise = store . dispatch ( createShardKey ( shardKeyData ) ) ;
709711 mockShardingError = false ;
710- expect ( store . getState ( ) . status ) . to . equal ( 'SUBMITTING_FOR_SHARDING_ERROR' ) ;
712+ expect ( store . getState ( ) . isSubmittingForSharding ) . to . equal ( true ) ;
711713 await promise ;
712714 expect ( store . getState ( ) . status ) . to . equal ( 'SHARDING' ) ;
713715
@@ -716,6 +718,7 @@ describe('GlobalWritesStore Store', function () {
716718 clock . tick ( POLLING_INTERVAL ) ;
717719 await waitFor ( ( ) => {
718720 expect ( store . getState ( ) . status ) . to . equal ( 'SHARD_KEY_CORRECT' ) ;
721+ expect ( store . getState ( ) . isSubmittingForSharding ) . to . be . undefined ;
719722 } ) ;
720723 } ) ;
721724
0 commit comments