Skip to content

Commit

Permalink
more test refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
chrstinalin committed Dec 2, 2024
1 parent d826a12 commit fb246c0
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/amo/components/AutoSearchInput/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export class AutoSearchInputBase extends React.Component<InternalProps, State> {
addonId: undefined,
iconUrl: getAddonIconUrl(),
name: this.props.i18n.gettext('Loading'),
promoted: null,
promoted: [],
url: undefined,
});
}
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/amo/components/TestAddonsCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ describe(__filename, () => {
{ name: 'A groovy developer' },
],
average_daily_users: 5253,
promoted: null,
promoted: [],
name: createLocalizedString(name),
slug,
...props,
Expand Down Expand Up @@ -682,7 +682,7 @@ describe(__filename, () => {
});

it('does not display a promoted badge when the addon is not promoted', () => {
renderWithResult({ addonProps: { promoted: null } });
renderWithResult({ addonProps: { promoted: [] } });

expect(
screen.queryByRole('link', {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/amo/components/TestAutoSearchInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ describe(__filename, () => {
});

it('does not display a promoted icon when the add-on is not promoted', async () => {
const result = createFakeAutocompleteResult({ promoted: null });
const result = createFakeAutocompleteResult({ promoted: [] });
render();

await typeInSearch('test');
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/amo/components/TestInstallButtonWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ describe(__filename, () => {

it.each([
// An unpromoted add-on.
{ ...fakeAddon, promoted: null },
{ ...fakeAddon, promoted: [] },
// An add-on which is promoted, but not for the current app.
{
...fakeAddon,
Expand Down Expand Up @@ -1459,7 +1459,7 @@ describe(__filename, () => {

it.each([
// An unpromoted theme.
{ ...fakeAddon, promoted: null },
{ ...fakeAddon, promoted: [] },
// A promoted theme.
{
...fakeAddon,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/amo/sagas/test_addons.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ describe(__filename, () => {
},
// Assume extension.
type: ADDON_TYPE_EXTENSION,
promoted: null,
promoted: [],
created: new Date(0),
last_updated: null,
status: 'unknown-non-public',
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/amo/utils/test_compatibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ describe(__filename, () => {
it('returns true when add-on is not promoted', () => {
const addon = createInternalAddonWithLang({
...fakeAddon,
promoted: null,
promoted: [],
});

expect(isAndroidInstallable({ addon })).toEqual(true);
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export const fakeAddon = Object.freeze({
last_updated: '2018-11-22T10:09:01Z',
name: createLocalizedString('Chill Out'),
previews: [fakePreview],
promoted: null,
promoted: [],
ratings: {
average: 3.5,
count: 10,
Expand Down Expand Up @@ -629,7 +629,7 @@ export function createFakeAutocompleteResult({
id: randomId(),
icon_url: `https://addons.mozilla.org/${name}.png`,
name: createLocalizedString(name),
promoted: null,
promoted: [],
url: `https://example.org/en-US/firefox/addons/${name}/`,
...props,
};
Expand Down

0 comments on commit fb246c0

Please sign in to comment.