@@ -10,21 +10,16 @@ import {
10
10
ADDON_TYPE_STATIC_THEME ,
11
11
CLIENT_APP_ANDROID ,
12
12
CLIENT_APP_FIREFOX ,
13
- FATAL_ERROR ,
14
13
INCOMPATIBLE_ANDROID_UNSUPPORTED ,
15
14
INCOMPATIBLE_FIREFOX_FOR_IOS ,
16
15
INCOMPATIBLE_NOT_FIREFOX ,
17
- INCOMPATIBLE_OVER_MAX_VERSION ,
18
16
INCOMPATIBLE_UNDER_MIN_VERSION ,
19
- INCOMPATIBLE_UNSUPPORTED_PLATFORM ,
20
- INSTALLING ,
21
17
STRATEGIC ,
22
18
VERIFIED ,
23
19
} from 'amo/constants' ;
24
20
import { extractId } from 'amo/pages/AddonVersions' ;
25
21
import { formatFilesize } from 'amo/i18n/utils' ;
26
22
import { FETCH_ADDON , fetchAddon , loadAddon } from 'amo/reducers/addons' ;
27
- import { setInstallError , setInstallState } from 'amo/reducers/installations' ;
28
23
import { getPromotedBadgesLinkUrl } from 'amo/utils' ;
29
24
import {
30
25
correctedLocationForPlatform ,
@@ -645,104 +640,11 @@ describe(__filename, () => {
645
640
) . toBeInTheDocument ( ) ;
646
641
} ) ;
647
642
648
- const setupInstallError = ( ) => {
649
- const guid = 'some-guid' ;
650
- const addon = { ...fakeAddon , guid, slug : defaultSlug } ;
651
- store . dispatch ( setInstallState ( { guid, status : INSTALLING } ) ) ;
652
- store . dispatch ( setInstallError ( { error : FATAL_ERROR , guid } ) ) ;
653
- _loadAddon ( addon ) ;
654
- } ;
655
-
656
- it ( 'passes an install error to AddonInstallError' , ( ) => {
657
- setupInstallError ( ) ;
658
- _loadVersions ( ) ;
659
- render ( ) ;
660
-
661
- expect (
662
- within ( screen . getByClassName ( 'AddonInstallError' ) ) . getByText (
663
- 'An unexpected error occurred.' ,
664
- ) ,
665
- ) . toBeInTheDocument ( ) ;
666
- } ) ;
667
-
668
- it ( 'does not render an install error if there is no error' , ( ) => {
669
- renderWithAddonAndVersions ( ) ;
670
- render ( ) ;
671
-
672
- expect (
673
- screen . queryByClassName ( 'AddonInstallError' ) ,
674
- ) . not . toBeInTheDocument ( ) ;
675
- } ) ;
676
-
677
- it ( 'does not render an AddonInstallError if there is no version' , ( ) => {
678
- setupInstallError ( ) ;
679
- _loadVersions ( { versions : [ ] } ) ;
680
- render ( ) ;
681
-
682
- expect (
683
- screen . queryByClassName ( 'AddonInstallError' ) ,
684
- ) . not . toBeInTheDocument ( ) ;
685
- } ) ;
686
-
687
- it ( 'does not render an AddonInstallError if it is not the current version' , ( ) => {
688
- setupInstallError ( ) ;
689
- _loadVersions ( {
690
- versions : [ fakeVersion , { ...fakeVersion , id : 2 } ] ,
691
- } ) ;
692
- render ( ) ;
693
-
694
- const versionCards = allVersionCards ( ) ;
695
- expect (
696
- within ( versionCards [ 0 ] ) . getByText ( 'An unexpected error occurred.' ) ,
697
- ) . toBeInTheDocument ( ) ;
698
- expect (
699
- within ( versionCards [ 1 ] ) . queryByText ( 'An unexpected error occurred.' ) ,
700
- ) . not . toBeInTheDocument ( ) ;
701
- } ) ;
702
-
703
- it ( 'does not render an AddonCompatibilityError if there is no version' , ( ) => {
704
- getClientCompatibility . mockReturnValue (
705
- createFakeClientCompatibility ( {
706
- compatible : false ,
707
- reason : INCOMPATIBLE_OVER_MAX_VERSION ,
708
- } ) ,
709
- ) ;
710
- renderWithAddonAndVersions ( { versions : [ ] } ) ;
711
-
712
- expect (
713
- screen . queryByClassName ( 'AddonCompatibilityError' ) ,
714
- ) . not . toBeInTheDocument ( ) ;
715
- } ) ;
716
-
717
- it ( 'does not render an AddonCompatibilityError if it is not the current version' , ( ) => {
718
- getClientCompatibility . mockReturnValue (
719
- createFakeClientCompatibility ( {
720
- compatible : false ,
721
- reason : INCOMPATIBLE_OVER_MAX_VERSION ,
722
- } ) ,
723
- ) ;
724
- renderWithAddonAndVersions ( {
725
- versions : [ fakeVersion , { ...fakeVersion , id : 2 } ] ,
726
- } ) ;
727
-
728
- const versionCards = allVersionCards ( ) ;
729
- expect (
730
- within ( versionCards [ 0 ] ) . getByText (
731
- 'This add-on is not compatible with your version of Firefox.' ,
732
- ) ,
733
- ) . toBeInTheDocument ( ) ;
734
- expect (
735
- within ( versionCards [ 1 ] ) . queryByText (
736
- 'This add-on is not compatible with your version of Firefox.' ,
737
- ) ,
738
- ) . not . toBeInTheDocument ( ) ;
739
- } ) ;
740
-
741
643
it ( 'passes an add-on to InstallButtonWrapper' , ( ) => {
742
644
renderWithAddonAndVersions ( ) ;
743
645
744
646
expect (
745
- screen . getByRole ( 'link' , { name : 'Add to Firefox ' } ) ,
647
+ screen . getByRole ( 'link' , { name : 'Download file ' } ) ,
746
648
) . toHaveAttribute ( 'href' , fakeVersion . file . url ) ;
747
649
} ) ;
748
650
@@ -763,7 +665,7 @@ describe(__filename, () => {
763
665
const versionCards = allVersionCards ( ) ;
764
666
expect ( versionCards ) . toHaveLength ( 2 ) ;
765
667
expect (
766
- within ( versionCards [ 0 ] ) . getByRole ( 'link' , { name : 'Add to Firefox ' } ) ,
668
+ within ( versionCards [ 0 ] ) . getByRole ( 'link' , { name : 'Download file ' } ) ,
767
669
) . toBeInTheDocument ( ) ;
768
670
expect (
769
671
within ( versionCards [ 1 ] ) . getByRole ( 'link' , { name : 'Download file' } ) ,
@@ -849,39 +751,6 @@ describe(__filename, () => {
849
751
) . not . toBeInTheDocument ( ) ;
850
752
} ) ;
851
753
852
- it ( 'renders a notice if add-on is over maxVersion/compat is strict' , ( ) => {
853
- getClientCompatibility . mockReturnValue (
854
- createFakeClientCompatibility ( {
855
- compatible : false ,
856
- reason : INCOMPATIBLE_OVER_MAX_VERSION ,
857
- } ) ,
858
- ) ;
859
- renderWithAddonAndVersions ( ) ;
860
-
861
- expect (
862
- screen . getByClassName ( 'AddonCompatibilityError' ) ,
863
- ) . toBeInTheDocument ( ) ;
864
- expect (
865
- screen . getByText (
866
- 'This add-on is not compatible with your version of Firefox.' ,
867
- ) ,
868
- ) . toBeInTheDocument ( ) ;
869
- } ) ;
870
-
871
- it ( 'renders a notice if add-on is incompatible with the platform' , ( ) => {
872
- getClientCompatibility . mockReturnValue (
873
- createFakeClientCompatibility ( {
874
- compatible : false ,
875
- reason : INCOMPATIBLE_UNSUPPORTED_PLATFORM ,
876
- } ) ,
877
- ) ;
878
- renderWithAddonAndVersions ( ) ;
879
-
880
- expect (
881
- screen . getByText ( 'This add-on is not available on your platform.' ) ,
882
- ) . toBeInTheDocument ( ) ;
883
- } ) ;
884
-
885
754
it . each ( [
886
755
INCOMPATIBLE_ANDROID_UNSUPPORTED ,
887
756
INCOMPATIBLE_FIREFOX_FOR_IOS ,
0 commit comments