Skip to content

Commit

Permalink
add logic to test that makes sure props contains an array
Browse files Browse the repository at this point in the history
  • Loading branch information
jonfriskics committed May 15, 2018
1 parent a69dda3 commit 3817b43
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/unit/mocha/part3/book-item-contains-props.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ describe('BookItem.vue', () => {
let results = esquery(ast, 'ExportDefaultDeclaration Property[key.name="name"] Literal[value="BookItem"]');
assert(results.length > 0, 'The BookItem component does not have a `name` property with the value of `BookItem` defined in the `export default` section');

results = esquery(ast, 'ExportDefaultDeclaration Property[key.name="props"] Literal[value="book"]');
assert(results.length > 0, 'The BookItem component does not have a `props` property with an array value containing the string `book` defined in the `export default` section');
// console.log(esquery(ast, 'ExportDefaultDeclaration Property[key.name="props"]'))
results = esquery(ast, 'ExportDefaultDeclaration Property[key.name="props"]');
// console.log(results[0].value)
assert(results.length > 0 && results[0].value.type == 'ArrayExpression' && results[0].value.elements[0].value == 'book', 'The BookItem component does not have a `props` property with an array value containing the string `book` defined in the `export default` section');
});
});

0 comments on commit 3817b43

Please sign in to comment.