Skip to content

Commit

Permalink
Change tests from being an array to being an empty array with concat …
Browse files Browse the repository at this point in the history
…call
  • Loading branch information
uncommon-type committed Feb 22, 2022
1 parent 7ddf14a commit d2c35b6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions __tests__/src/rules/img-redundant-alt-test.js
Expand Up @@ -30,8 +30,7 @@ const expectedError = {
};

ruleTester.run('img-redundant-alt', rule, {
valid: semver.satisfies(eslintVersion, '>= 6') ? [{ code: '<img alt={imageAlt?.name} />', parserOptions: { ecmaVersion: 2020 } },
{ code: '<img alt="Doing cool things" aria-hidden={foo?.bar}/>', parserOptions: { ecmaVersion: 2020 } }].map(parserOptionsMapper) : [
valid: [].concat(
{ code: '<img alt="foo" />;' },
{ code: '<img alt="picture of me taking a photo of an image" aria-hidden />' },
{ code: '<img aria-hidden alt="photo of image" />' },
Expand All @@ -58,9 +57,13 @@ ruleTester.run('img-redundant-alt', rule, {
{ code: '<img alt />' },
{ code: '<img alt={imageAlt} />' },
{ code: '<img alt={imageAlt.name} />' },
semver.satisfies(eslintVersion, '>= 6') ? [
{ code: '<img alt={imageAlt?.name} />', parserOptions: { ecmaVersion: 2020 } },
{ code: '<img alt="Doing cool things" aria-hidden={foo?.bar}/>', parserOptions: { ecmaVersion: 2020 } },
] : [],
{ code: '<img alt="Photography" />;' },
{ code: '<img alt="ImageMagick" />;' },
].map(parserOptionsMapper),
).map(parserOptionsMapper),
invalid: [
{ code: '<img alt="Photo of friend." />;', errors: [expectedError] },
{ code: '<img alt="Picture of friend." />;', errors: [expectedError] },
Expand Down

0 comments on commit d2c35b6

Please sign in to comment.