-
Notifications
You must be signed in to change notification settings - Fork 28
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
Support user subclass before save #28
Support user subclass before save #28
Conversation
@@ -112,8 +112,7 @@ function runHook(className, hookType, data) { | |||
object: model, | |||
user: "ParseMockDB doesn't define request.user." | |||
}; | |||
|
|||
return hook(beforeSaveOrBeforeDeleteRequestObject).bind(model)().then((beforeSaveOverrideValue) => { | |||
return hook(beforeSaveOrBeforeDeleteRequestObject).then((beforeSaveOverrideValue) => { |
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 wish i understood what the .bind(model)() was supposed to do and if it should be there. but now the unit tests pass.
:( any insight you guys can give me as to what it was supposed to do, ideally in the form of a failing test so i can try to figure it out.....
7dadc87
to
6a3414b
Compare
@fatuhoku take a look. I rebased your changes, and i took a look at what you did in handle_request, but when i factored it out, i found that it is exactly the same as what was there before? I fixed the unit tests, but I now need a unit test that fails, cause this really looks like a noop to me? maybe something was fixed in between and when i rebased it, everything just worked?? |
11ca00f
to
9598db4
Compare
@TylerBrock I think that this can be closed unless you think that the extra unit tests are worth keeping? If so, I'll rebase. |
@fatuhoku I hope you'll try head again and if there is any functionality that you've got implemented that isn't in head, I'd be glad to work with you to get it worked into head!!! |
Pass in the request object into the beforeSave handler. Rename variable. Rename request. Add failing test for beforeDelete. Fix test by switching the flag. Fail test again by not defining a return value. Reason about beforeSave override value. Fix test by performing deletion. Simplify creation of Brand. Remove TODO by adding assertion for empty collection. Add assertions for the state of the mock collection. Fix semicolons. Replace => syntax with function() syntax. Inline variable. Remove whitespace.
9598db4
to
511c1d7
Compare
1. don't use switch 2. get unit tests in working order 3. remove code duplication in unit tests.
511c1d7
to
789a65f
Compare
@TylerBrock probably?
it's certainly valid that those tests should be run twice, once for a "plain" parse class, and once for the special parse class _User, but the code shouldn't be duplicated. I'll see if can quickly refactor, if so I'll amend this. if not, we should probably merge it anyway :). |
combined the tests for parse objects and _User using @fatuhoku methods. Nice! yup, @TylerBrock I'd like you to review it for merge. |
I figured out how to set up lint for this stuff using eslint.
@TylerBrock nudge |
Hey sorry for the delay. I'm out of town this weekend. Most likely I'll review on Tuesday. |
I don't think this is mergeable if the deep save test fails. Can we figure out what is going on there? |
i didn't touch that test https://github.com/HustleInc/parse-mockdb/blob/master/test/test.js#L830 it fails on master too. the only thing i did was change the test from being commented out to marked skip using which is nice because it shows that the test is skipped when you npm test:
The test's comment cites an issue that you had opened: parse-community/Parse-SDK-JS#91 the issue was marked resolved in parse sdk in version 1.6.14. I'm running 1.8.5 as our package.json has I can open an issue on this repo and look into why it still fails, any background you have might be helpful? |
Oh, duh, thank you! Much better! It was too early to be looking at diffs apparently. Yeah, it would be great to get an issue to track it. Would be happy to fill in info where necessary. |
Two questions:
|
Yeah the readme and some code comments need updating. Will do. |
no opinion on release. here's an update for the readme: #41 |
fixes #25
unit test coverage for _User class
PS the third commit 75c99d2 just adds semicolons. was bothering me and i figured out linting....