-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add test asserting no unnecessary inverse work #4247
Conversation
The test fails without the original PR commit. Still need to add a test to ensure inverse searching is not done if a specific relationship is indicated for the inverse. |
This test needs to assert the final state is as expected, the test as-is would pass if the input data was merely incorrect. |
I feel like a "final state" test should be separate from the test added in this PR. The final state and avoiding unnecessary work are two distinct concerns/expectations. Additionally, the relationship integration tests already assert final state of relationships where inverse is explicitly set to null. Is there some additional specific concern that we need to test here? |
sorta, so, this only tests that an explicit method for handling inverses is NOT called, but that isn't refactoring friendly. A more robust test would also include a scenario where the both the method is called and isn't called. That way the test would fail, if the mechanism of calculating inverses changed was refactored out. Which would hopefully force the refactorer to consider this scenario. My suggestion should be a small addition to your existing tests, and would provide a high confidence regression test. |
Ah, that makes sense. I'll update the PR. |
@asakusuma sorry, I was having a hard time trying to convey what i meant here Thanks for your patience. |
3e43943
to
04a114b
Compare
@stefanpenner no problem, thanks for the guidance. I've updated the tests accordingly. @krisselden @pangratz it's going to take some reworking in order to test that inverse resolution work is not done when inverse is explicitly set. EDIT: link to data/addon/-private/system/relationships/ext.js Lines 246 to 263 in e5636f3
|
@asakusuma the updated tests look wonderful, thank you :) |
Add test asserting no unnecessary inverse work
Ensures that if
inverse: null
,inverseFor
is not called.Test for #4225. Addresses #4236.
cc @krisselden @stefanpenner @pangratz