unfetch icon indicating copy to clipboard operation
unfetch copied to clipboard

Regex tests

Open dimpiax opened this issue 8 years ago • 8 comments

Need to add regex tests. Tested expression on validators, it gives strange results. @developit could you provide expectations?

dimpiax avatar Mar 11 '17 11:03 dimpiax

What regex tests?

tunnckoCore avatar Mar 11 '17 13:03 tunnckoCore

For /^(.*?):\s*([\s\S]*?)$/gm. What do we expect for input?

dimpiax avatar Mar 11 '17 17:03 dimpiax

I can't get what you're talking about. Where's that? What regexes here?

tunnckoCore avatar Mar 11 '17 18:03 tunnckoCore

28 lines.

dimpiax avatar Mar 11 '17 18:03 dimpiax

Good moin'. Next time when open an issue describe what you mean as much as possible in your title and first post.

tunnckoCore avatar Mar 11 '17 18:03 tunnckoCore

Wonder that you have not understand. Anyway mention was not for you.

dimpiax avatar Mar 11 '17 20:03 dimpiax

@dimpiax I had a bunch of tests I was running in a REPL when writing the header parsing, I should have ported them to unit tests but didn't. Happy to merge a PR that does it. Easiest way will be to mock out XMLHttpRequest, stub getAllResponseHeaders() to return any variances we can find, and then invoke onload() manually.

developit avatar Mar 12 '17 16:03 developit

@developit considering the changes to the headers regex in #92 I'm not sure of the best way to test this anymore. The headers regex is now extremely simple and we're leveraging the internals of XMLHttpRequest with getResponseHeader(). You'll see in that PR the headers tests are by no means comprehensive. Stubbing getResponseHeader in this case isn't really a very useful test. Do we just rely on the XMLHttpRequest internals and only test our (very simple) regex then?

simonbuerger avatar Oct 12 '18 07:10 simonbuerger