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

Various JSONP upgrades #42

Merged
merged 3 commits into from
Apr 2, 2019
Merged

Various JSONP upgrades #42

merged 3 commits into from
Apr 2, 2019

Conversation

let o = { foo: 'bar' },
queryParamName = overrideQueryParamName || 'callback',
body = `/**/ typeof fooFunction === 'function' && fooFunction(${JSON.stringify(o)});`;
const test = (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not too thrilled with the increase in number of code paths through this test function. However, don't have any good ideas to improve the situation at the moment. Thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, this went from bad to atrocious. Couldn't the expectations, at least, have been prevented by using extenders? That was the point of the test extender.

@coveralls
Copy link

coveralls commented Mar 22, 2019

Coverage Status

Coverage increased (+0.01%) to 99.277% when pulling 5b5b7d9 on jsonp_upgrades into 0bbf862 on master.

expect(response._isValidJSONPCallback('callback')).to.strictlyEqual(true);
expect(response._isValidJSONPCallback('_abc')).to.strictlyEqual(true);
expect(response._isValidJSONPCallback('$')).to.strictlyEqual(true);
expect(response._isValidJSONPCallback('funcs[123]')).to.strictlyEqual(true);
Copy link
Member

@jthomerson jthomerson Mar 24, 2019

Choose a reason for hiding this comment

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

Can we add more tests? For example, I don't see anything with a ., and we should not only test single cases, but mixed cases too (i.e. _ and $ and [..] and combinations thereof).

let o = { foo: 'bar' },
queryParamName = overrideQueryParamName || 'callback',
body = `/**/ typeof fooFunction === 'function' && fooFunction(${JSON.stringify(o)});`;
const test = (
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, this went from bad to atrocious. Couldn't the expectations, at least, have been prevented by using extenders? That was the point of the test extender.

@jthomerson jthomerson removed the request for review from yokuze March 25, 2019 13:09
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.

None yet

3 participants