-
Notifications
You must be signed in to change notification settings - Fork 135
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
Allow avoiding error returning when updating an llms post meta with the same value as stored in the db #2129
Conversation
472ca1a
to
08a65be
Compare
@gocodebox/engineering |
be5d75f
to
6ec46ea
Compare
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.
This looks pretty good to me. This is such a messy area of the codebase that this honestly seems to make it more messy to me but refactoring the code into separate methods is a good step towards making all of this a bit more testable and less fragile to maintain longterm.
I haven't physically run any tests but it looks solid given that existing unit tests are passing and the new tests you've added work. However, I'd like to see a bit more test coverage added here, specifically:
- Usage of the new param in
set()
method isn't covered at all. empty_data
error condition inset_bulk()
isn't coveredinvalid_data
error condition inset_bulk()
isn't covered- method
is_meta_value_same_as_stored_value()
is only tested for scalar values (strings). Tests could be written to test this method directly, ideally with every scalar type and at least one non scalar type being passed in. UsingLLMS_Unit_Test_Util::call_private_method()
so you can just pass stuff in directly. - You technically did not add anything related to setting post properties but there's no coverage on post properties here (I know other model tests pick it up but it wouldn't be too hard to add some post properties here while you're at it.
Co-authored-by: Thomas Patrick Levy <thomas@gocodebox.com>
Yeah
True.
Yeah, I haven't added unit tests for old code.
You're right.
Because this PR didn't change the behavior on post properties: old code. I can add more tests coverage though <3 |
@eri-trabiccolo I realize that you didn't add tests for old code but since you're moving that old code and writing code all around it it's a good opportunity to add some tests to that old code. |
Yeah sorry, what I meant was that despite what it looks like the PR introduces very little changes, and those are tested. |
@thomasplevy added various tests. |
Description
Fixes #909 and needed to fix gocodebox/lifterlms-rest#222
This PR, aside from some code reorganization, just adds this piece of code:
https://github.com/gocodebox/lifterlms/pull/2129/files#diff-3f0337a1db5180a72d1b5434e90b08b7b0f4b7ee5997ac4dd50efa7b6d3c21a8R1482-R1497
How has this been tested?
existing unit tests (doesn't introduce any drawback since the old behavior is the default one).
working on new unit tests.
Screenshots
Types of changes
New feature (non-breaking change which adds functionality)
Checklist: