-
Notifications
You must be signed in to change notification settings - Fork 62
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
Delete all stubs #89
Delete all stubs #89
Conversation
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.
Thanks for the pull request! I have an ask before merging.
src/portals/admin.js
Outdated
this.endpoints.delete(id, callback); | ||
if (id) { | ||
this.endpoints.delete(id, callback); | ||
} else { |
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.
The only change I would ask is to ensure that the request was to /
to delete everything, instead of deleting everything if an id
wasn't captured.
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.
No worries 👍
Out of curiosity; what is an example url that might be something without an id? Is it just anything that isn't a number eg. /test
? Or with multiple directories in the path? eg. /123/test
. I just want to make sure I cover the right scenarios in a test.
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.
Those are good examples. I think the code as-is may actually work correctly (due to multiple checks against urlPattern
) but for a "delete everything" capability it is good to have tests ensuring it works as intended only on /
in case other capabilities are added later.
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.
Sounds good. I'll sort that out today.
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.
Updated
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.
Thanks!
I've added a DELETE method on the root admin url eg.
This will delete all stubs. It's quite handy for something like functional testing where you are setting up / tearing down fixture data for each test. The alternative is having to maintain a list of IDs for every stub you create.