Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw err on update if suggestions are invalid type #256

Merged
merged 3 commits into from
Oct 15, 2018

Conversation

cdtinney
Copy link
Contributor

@cdtinney cdtinney commented Oct 9, 2018

Resolves #131

Summary

Throws an error if suggestions provided by a dataset are not valid type (Array). This helps the developer/user understand why results aren't displayed rather than silently failing.

@coveralls
Copy link

coveralls commented Oct 9, 2018

Coverage Status

Coverage increased (+0.02%) to 88.877% when pulling d4573d3 on cdtinney:bugfix-dataset-validation into 0e65fee on algolia:master.

Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great call!

@@ -80,6 +80,10 @@ describe('Dataset', function() {
expect(this.dataset.getRoot()).toContainText('empty');
});

it('should throw an error if suggestions is not an array', function() {
expect(this.source.and.callFake(fakeGetNonArrayResults)).toThrow();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can assert some of the text of the array. I forgot if this is Jest or not, but if it is: toThrowErrorMatchingSnapshot()

@cdtinney
Copy link
Contributor Author

Should this be merged in?

@Haroenv Haroenv merged commit 179febf into algolia:master Oct 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants