Skip to content

Commit

Permalink
Merge pull request #930 from bmish/no-restricted-resolver-tests-fix-s…
Browse files Browse the repository at this point in the history
…pread

Fix spread syntax crash in `no-restricted-resolver-tests` rule
  • Loading branch information
bmish committed Sep 7, 2020
2 parents b77e14f + 3f080b7 commit b51433c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/rules/no-restricted-resolver-tests.js
Expand Up @@ -32,19 +32,26 @@ function hasOnlyStringArgument(node) {

function hasUnitTrue(node) {
return node.properties.some(
(property) => property.key.name === 'unit' && property.value.value === true
(property) =>
types.isProperty(property) && property.key.name === 'unit' && property.value.value === true
);
}

function hasNeeds(node) {
return node.properties.some(
(property) => property.key.name === 'needs' && property.value.type === 'ArrayExpression'
(property) =>
types.isProperty(property) &&
property.key.name === 'needs' &&
property.value.type === 'ArrayExpression'
);
}

function hasIntegrationTrue(node) {
return node.properties.some(
(property) => property.key.name === 'integration' && property.value.value === true
(property) =>
types.isProperty(property) &&
property.key.name === 'integration' &&
property.value.value === true
);
}

Expand Down
2 changes: 2 additions & 0 deletions tests/lib/rules/no-restricted-resolver-tests.js
Expand Up @@ -12,13 +12,15 @@ const { ERROR_MESSAGES } = rule;
//------------------------------------------------------------------------------

const ruleTester = new RuleTester({
parser: require.resolve('babel-eslint'),
parserOptions: { ecmaVersion: 6, sourceType: 'module' },
});
ruleTester.run('no-restricted-resolver-tests', rule, {
valid: [
`
import { moduleFor } from 'ember-qunit';
moduleFor('service:session', {
...foo,
integration: true
});
`,
Expand Down

0 comments on commit b51433c

Please sign in to comment.