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
fix: add missing fields to 'FindOrCreateType' #12338
Conversation
Codecov Report
@@ Coverage Diff @@
## master #12338 +/- ##
=======================================
Coverage 96.40% 96.40%
=======================================
Files 95 95
Lines 9116 9116
=======================================
Hits 8788 8788
Misses 328 328 Continue to review full report at Codecov.
|
Please add a test here https://github.com/sequelize/sequelize/blob/master/types/test/model.ts |
@sushantdhiman I've added a handful of tests 👍 |
types/test/model.ts
Outdated
} | ||
}) | ||
|
||
if (! created) { |
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.
These tests are supposed to only test syntax, not actually doing any db operations. I don't think these conditions or checks should be included in this code.
Just add some calls to <Model>.findOrCreate
to assert correct typings or move these to e2e
if you prefer that
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.
Yes these tests are not actually executed, they are merely type checked.
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.
Ok, I have added only the typings because I have seen enough tests for findOrCreate
in the integrations folder. Thank you for your guidance!
Pull Request check-list
Please make sure to review and check all of these items:
npm run test
ornpm run test-DIALECT
pass with this change (including linting)?Description of change
This PR includes some typings needed to provide clarification in regards to the usage of
findOrCreate
functionality, thus theFindOrCreateOptions
interface has been altered to include thefields
string array to whitelist which fields should be persisted as explained in #12325 . Tests are not passing, as well as in master upstream.