@@ -423,97 +423,114 @@ describe('utils/subject.ts', () => {
423
423
it ( 'open issue state' , async ( ) => {
424
424
nock ( 'https://api.github.com' )
425
425
. get ( '/repos/manosim/notifications-test/issues/1' )
426
- . reply ( 200 , { state : 'open' } ) ;
426
+ . reply ( 200 , { state : 'open' , user : { login : 'some-user' } } ) ;
427
427
428
428
nock ( 'https://api.github.com' )
429
429
. get ( '/repos/manosim/notifications-test/issues/comments/302888448' )
430
- . reply ( 200 , { user : { login : 'some-user ' } } ) ;
430
+ . reply ( 200 , { user : { login : 'some-commenter ' } } ) ;
431
431
432
432
const result = await getGitifySubjectDetails (
433
433
mockedSingleNotification ,
434
434
mockAccounts . token ,
435
435
) ;
436
436
437
437
expect ( result . state ) . toBe ( 'open' ) ;
438
- expect ( result . user ) . toBe ( 'some-user ' ) ;
438
+ expect ( result . user ) . toBe ( 'some-commenter ' ) ;
439
439
} ) ;
440
440
441
441
it ( 'closed issue state' , async ( ) => {
442
442
nock ( 'https://api.github.com' )
443
443
. get ( '/repos/manosim/notifications-test/issues/1' )
444
- . reply ( 200 , { state : 'closed' } ) ;
444
+ . reply ( 200 , { state : 'closed' , user : { login : 'some-user' } } ) ;
445
445
446
446
nock ( 'https://api.github.com' )
447
447
. get ( '/repos/manosim/notifications-test/issues/comments/302888448' )
448
- . reply ( 200 , { user : { login : 'some-user ' } } ) ;
448
+ . reply ( 200 , { user : { login : 'some-commenter ' } } ) ;
449
449
450
450
const result = await getGitifySubjectDetails (
451
451
mockedSingleNotification ,
452
452
mockAccounts . token ,
453
453
) ;
454
454
455
455
expect ( result . state ) . toBe ( 'closed' ) ;
456
- expect ( result . user ) . toBe ( 'some-user ' ) ;
456
+ expect ( result . user ) . toBe ( 'some-commenter ' ) ;
457
457
} ) ;
458
458
459
459
it ( 'completed issue state' , async ( ) => {
460
460
nock ( 'https://api.github.com' )
461
461
. get ( '/repos/manosim/notifications-test/issues/1' )
462
- . reply ( 200 , { state : 'closed' , state_reason : 'completed' } ) ;
462
+ . reply ( 200 , {
463
+ state : 'closed' ,
464
+ state_reason : 'completed' ,
465
+ user : { login : 'some-user' } ,
466
+ } ) ;
463
467
464
468
nock ( 'https://api.github.com' )
465
469
. get ( '/repos/manosim/notifications-test/issues/comments/302888448' )
466
- . reply ( 200 , { user : { login : 'some-user ' } } ) ;
470
+ . reply ( 200 , { user : { login : 'some-commenter ' } } ) ;
467
471
468
472
const result = await getGitifySubjectDetails (
469
473
mockedSingleNotification ,
470
474
mockAccounts . token ,
471
475
) ;
472
476
473
477
expect ( result . state ) . toBe ( 'completed' ) ;
474
- expect ( result . user ) . toBe ( 'some-user ' ) ;
478
+ expect ( result . user ) . toBe ( 'some-commenter ' ) ;
475
479
} ) ;
476
480
477
481
it ( 'not_planned issue state' , async ( ) => {
478
482
nock ( 'https://api.github.com' )
479
483
. get ( '/repos/manosim/notifications-test/issues/1' )
480
- . reply ( 200 , { state : 'open' , state_reason : 'not_planned' } ) ;
484
+ . reply ( 200 , {
485
+ state : 'open' ,
486
+ state_reason : 'not_planned' ,
487
+ user : { login : 'some-user' } ,
488
+ } ) ;
481
489
482
490
nock ( 'https://api.github.com' )
483
491
. get ( '/repos/manosim/notifications-test/issues/comments/302888448' )
484
- . reply ( 200 , { user : { login : 'some-user ' } } ) ;
492
+ . reply ( 200 , { user : { login : 'some-commenter ' } } ) ;
485
493
486
494
const result = await getGitifySubjectDetails (
487
495
mockedSingleNotification ,
488
496
mockAccounts . token ,
489
497
) ;
490
498
491
499
expect ( result . state ) . toBe ( 'not_planned' ) ;
492
- expect ( result . user ) . toBe ( 'some-user ' ) ;
500
+ expect ( result . user ) . toBe ( 'some-commenter ' ) ;
493
501
} ) ;
494
502
495
503
it ( 'reopened issue state' , async ( ) => {
496
504
nock ( 'https://api.github.com' )
497
505
. get ( '/repos/manosim/notifications-test/issues/1' )
498
- . reply ( 200 , { state : 'open' , state_reason : 'reopened' } ) ;
506
+ . reply ( 200 , {
507
+ state : 'open' ,
508
+ state_reason : 'reopened' ,
509
+ user : { login : 'some-user' } ,
510
+ } ) ;
499
511
500
512
nock ( 'https://api.github.com' )
501
513
. get ( '/repos/manosim/notifications-test/issues/comments/302888448' )
502
- . reply ( 200 , { user : { login : 'some-user ' } } ) ;
514
+ . reply ( 200 , { user : { login : 'some-commenter ' } } ) ;
503
515
504
516
const result = await getGitifySubjectDetails (
505
517
mockedSingleNotification ,
506
518
mockAccounts . token ,
507
519
) ;
508
520
509
521
expect ( result . state ) . toBe ( 'reopened' ) ;
510
- expect ( result . user ) . toBe ( 'some-user ' ) ;
522
+ expect ( result . user ) . toBe ( 'some-commenter ' ) ;
511
523
} ) ;
512
524
513
525
it ( 'handle issues without latest_comment_url' , async ( ) => {
514
526
nock ( 'https://api.github.com' )
515
527
. get ( '/repos/manosim/notifications-test/issues/1' )
516
- . reply ( 200 , { state : 'open' , draft : false , merged : false } ) ;
528
+ . reply ( 200 , {
529
+ state : 'open' ,
530
+ draft : false ,
531
+ merged : false ,
532
+ user : { login : 'some-user' } ,
533
+ } ) ;
517
534
518
535
const result = await getGitifySubjectDetails (
519
536
{
@@ -527,7 +544,7 @@ describe('utils/subject.ts', () => {
527
544
) ;
528
545
529
546
expect ( result . state ) . toBe ( 'open' ) ;
530
- expect ( result . user ) . toBeNull ( ) ;
547
+ expect ( result . user ) . toBe ( 'some-user' ) ;
531
548
} ) ;
532
549
} ) ;
533
550
@@ -543,79 +560,104 @@ describe('utils/subject.ts', () => {
543
560
it ( 'closed pull request state' , async ( ) => {
544
561
nock ( 'https://api.github.com' )
545
562
. get ( '/repos/manosim/notifications-test/issues/1' )
546
- . reply ( 200 , { state : 'closed' , draft : false , merged : false } ) ;
563
+ . reply ( 200 , {
564
+ state : 'closed' ,
565
+ draft : false ,
566
+ merged : false ,
567
+ user : { login : 'some-user' } ,
568
+ } ) ;
547
569
548
570
nock ( 'https://api.github.com' )
549
571
. get ( '/repos/manosim/notifications-test/issues/comments/302888448' )
550
- . reply ( 200 , { user : { login : 'some-user ' } } ) ;
572
+ . reply ( 200 , { user : { login : 'some-commenter ' } } ) ;
551
573
552
574
const result = await getGitifySubjectDetails (
553
575
mockNotification ,
554
576
mockAccounts . token ,
555
577
) ;
556
578
557
579
expect ( result . state ) . toBe ( 'closed' ) ;
558
- expect ( result . user ) . toBe ( 'some-user ' ) ;
580
+ expect ( result . user ) . toBe ( 'some-commenter ' ) ;
559
581
} ) ;
560
582
561
583
it ( 'draft pull request state' , async ( ) => {
562
584
nock ( 'https://api.github.com' )
563
585
. get ( '/repos/manosim/notifications-test/issues/1' )
564
- . reply ( 200 , { state : 'open' , draft : true , merged : false } ) ;
586
+ . reply ( 200 , {
587
+ state : 'open' ,
588
+ draft : true ,
589
+ merged : false ,
590
+ user : { login : 'some-user' } ,
591
+ } ) ;
565
592
566
593
nock ( 'https://api.github.com' )
567
594
. get ( '/repos/manosim/notifications-test/issues/comments/302888448' )
568
- . reply ( 200 , { user : { login : 'some-user ' } } ) ;
595
+ . reply ( 200 , { user : { login : 'some-commenter ' } } ) ;
569
596
570
597
const result = await getGitifySubjectDetails (
571
598
mockNotification ,
572
599
mockAccounts . token ,
573
600
) ;
574
601
575
602
expect ( result . state ) . toBe ( 'draft' ) ;
576
- expect ( result . user ) . toBe ( 'some-user ' ) ;
603
+ expect ( result . user ) . toBe ( 'some-commenter ' ) ;
577
604
} ) ;
578
605
579
606
it ( 'merged pull request state' , async ( ) => {
580
607
nock ( 'https://api.github.com' )
581
608
. get ( '/repos/manosim/notifications-test/issues/1' )
582
- . reply ( 200 , { state : 'open' , draft : false , merged : true } ) ;
609
+ . reply ( 200 , {
610
+ state : 'open' ,
611
+ draft : false ,
612
+ merged : true ,
613
+ user : { login : 'some-user' } ,
614
+ } ) ;
583
615
584
616
nock ( 'https://api.github.com' )
585
617
. get ( '/repos/manosim/notifications-test/issues/comments/302888448' )
586
- . reply ( 200 , { user : { login : 'some-user ' } } ) ;
618
+ . reply ( 200 , { user : { login : 'some-commenter ' } } ) ;
587
619
588
620
const result = await getGitifySubjectDetails (
589
621
mockNotification ,
590
622
mockAccounts . token ,
591
623
) ;
592
624
593
625
expect ( result . state ) . toBe ( 'merged' ) ;
594
- expect ( result . user ) . toBe ( 'some-user ' ) ;
626
+ expect ( result . user ) . toBe ( 'some-commenter ' ) ;
595
627
} ) ;
596
628
597
629
it ( 'open pull request state' , async ( ) => {
598
630
nock ( 'https://api.github.com' )
599
631
. get ( '/repos/manosim/notifications-test/issues/1' )
600
- . reply ( 200 , { state : 'open' , draft : false , merged : false } ) ;
632
+ . reply ( 200 , {
633
+ state : 'open' ,
634
+ draft : false ,
635
+ merged : false ,
636
+ user : { login : 'some-user' } ,
637
+ } ) ;
601
638
602
639
nock ( 'https://api.github.com' )
603
640
. get ( '/repos/manosim/notifications-test/issues/comments/302888448' )
604
- . reply ( 200 , { user : { login : 'some-user ' } } ) ;
641
+ . reply ( 200 , { user : { login : 'some-commenter ' } } ) ;
605
642
606
643
const result = await getGitifySubjectDetails (
607
644
mockNotification ,
608
645
mockAccounts . token ,
609
646
) ;
610
647
611
648
expect ( result . state ) . toBe ( 'open' ) ;
612
- expect ( result . user ) . toBe ( 'some-user ' ) ;
649
+ expect ( result . user ) . toBe ( 'some-commenter ' ) ;
613
650
} ) ;
614
651
615
652
it ( 'handle pull request without latest_comment_url' , async ( ) => {
616
653
nock ( 'https://api.github.com' )
617
654
. get ( '/repos/manosim/notifications-test/issues/1' )
618
- . reply ( 200 , { state : 'open' , draft : false , merged : false } ) ;
655
+ . reply ( 200 , {
656
+ state : 'open' ,
657
+ draft : false ,
658
+ merged : false ,
659
+ user : { login : 'some-user' } ,
660
+ } ) ;
619
661
620
662
const result = await getGitifySubjectDetails (
621
663
{
@@ -629,7 +671,7 @@ describe('utils/subject.ts', () => {
629
671
) ;
630
672
631
673
expect ( result . state ) . toBe ( 'open' ) ;
632
- expect ( result . user ) . toBeNull ( ) ;
674
+ expect ( result . user ) . toBe ( 'some-user' ) ;
633
675
} ) ;
634
676
} ) ;
635
677
} ) ;
0 commit comments