-
Notifications
You must be signed in to change notification settings - Fork 831
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
Ensure that ignoreUrlParametersMatching works with directoryIndex #762
Conversation
Fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you simplify the test at all? Reading it with the template literals everywhere I got really confused with that is the input and output . The actual fix makes total sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for the actual fix to workbox-sw.
I share Matt's concerns about the complexity of the testing setup and if there's anything that can be done to improve this that would be appreciated.
I've added some additional comments and refactored some of the variables, and hopefully it's mergeable now. I had initially tried to come up with a more straightforward way of testing the actual functionality, and what I ended up with was about as direct as I could figure out. (Stubbing out some of the |
promiseChain.then(() => { | ||
// Make sure that the cache.match() stub was called, indicating that | ||
// there was a match against the precached URL. | ||
if (stub.called) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is caches.match called with? Should it be with or without the directoryIndex value or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in a check.
// Request the URL without the directory index, but with the URL param. | ||
request: new Request(urlToRequest), | ||
}); | ||
fetchEvent.respondWith = (promiseChain) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you stub this out? Would make it a little easier to read / follow if you could
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I can stub out respondWith()
and still get things to work, no. (I copied this pattern from other tests in this suite, e.g. the previous test in this file.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you could add a check that the stub was called with the correct args that would be the only change I'd like to see, the other suggestion is a nit.
R: @addyosmani @gauntface
Fixes #758
This fixes a small bug due to using the wrong variable inside of our WorkboxSW precache route.