Skip to content

Commit a865a52

Browse files
committed
Removed tests relating to latest version, updated tests relating to older versions
1 parent 92ef94c commit a865a52

File tree

1 file changed

+2
-133
lines changed

1 file changed

+2
-133
lines changed

tests/unit/amo/pages/TestAddonVersions.js

+2-133
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,16 @@ import {
1010
ADDON_TYPE_STATIC_THEME,
1111
CLIENT_APP_ANDROID,
1212
CLIENT_APP_FIREFOX,
13-
FATAL_ERROR,
1413
INCOMPATIBLE_ANDROID_UNSUPPORTED,
1514
INCOMPATIBLE_FIREFOX_FOR_IOS,
1615
INCOMPATIBLE_NOT_FIREFOX,
17-
INCOMPATIBLE_OVER_MAX_VERSION,
1816
INCOMPATIBLE_UNDER_MIN_VERSION,
19-
INCOMPATIBLE_UNSUPPORTED_PLATFORM,
20-
INSTALLING,
2117
STRATEGIC,
2218
VERIFIED,
2319
} from 'amo/constants';
2420
import { extractId } from 'amo/pages/AddonVersions';
2521
import { formatFilesize } from 'amo/i18n/utils';
2622
import { FETCH_ADDON, fetchAddon, loadAddon } from 'amo/reducers/addons';
27-
import { setInstallError, setInstallState } from 'amo/reducers/installations';
2823
import { getPromotedBadgesLinkUrl } from 'amo/utils';
2924
import {
3025
correctedLocationForPlatform,
@@ -645,104 +640,11 @@ describe(__filename, () => {
645640
).toBeInTheDocument();
646641
});
647642

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-
741643
it('passes an add-on to InstallButtonWrapper', () => {
742644
renderWithAddonAndVersions();
743645

744646
expect(
745-
screen.getByRole('link', { name: 'Add to Firefox' }),
647+
screen.getByRole('link', { name: 'Download file' }),
746648
).toHaveAttribute('href', fakeVersion.file.url);
747649
});
748650

@@ -763,7 +665,7 @@ describe(__filename, () => {
763665
const versionCards = allVersionCards();
764666
expect(versionCards).toHaveLength(2);
765667
expect(
766-
within(versionCards[0]).getByRole('link', { name: 'Add to Firefox' }),
668+
within(versionCards[0]).getByRole('link', { name: 'Download file' }),
767669
).toBeInTheDocument();
768670
expect(
769671
within(versionCards[1]).getByRole('link', { name: 'Download file' }),
@@ -849,39 +751,6 @@ describe(__filename, () => {
849751
).not.toBeInTheDocument();
850752
});
851753

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-
885754
it.each([
886755
INCOMPATIBLE_ANDROID_UNSUPPORTED,
887756
INCOMPATIBLE_FIREFOX_FOR_IOS,

0 commit comments

Comments
 (0)