-
-
Notifications
You must be signed in to change notification settings - Fork 52
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: an entity with relations can be created also without them #79
Conversation
test/relations/empty.test.ts
Outdated
import { random } from 'faker' | ||
import { factory, primaryKey, oneOf } from '@mswjs/data' | ||
|
||
it('should not throw error if an entity with relation is created without it', () => { |
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 think this case should be added to all relevant test/relations/*.test.ts
files, because the way oneOf and manyOf relations are handled may differ. Think of it as a spec point in each relationship kind support, not a standalone behavior.
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 great, just need to structure the tests (add necessary test cases to the existing relationship tests).
I had moved the test in their relation files but you made the same my mistake of the other day haahahaha, my last commit is dropped hahahah. I'll add it again, then I'll add some tests for missing properties. |
@marcosvega91, I don't think I dropped anything... When I pushed to the feature branch its remote got 1 commit. This likely means that you committed something locally but haven't pushed yet. Meanwhile, I've pushed changes to the remote that you didn't have locally. When pulling, you probably gave priority to the remote changes, so your uncommitted local ones got discarded. What I usually do is If I have one local commit$ git reset HEAD^
$ git stash -u
$ git pull --rebase
$ git stash pop
$ git commit -m 'The same message I had before' I have multiple local commits$ git checkout -b temp
$ git checkout -
$ git pull --rebase --force
$ git rebase temp |
You're as always, hahaha. I had updated the code but didn't commited yet. Now I have moved the test in the different relation files. I'll add some other test for other fields |
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.
Thank you for your work on this!
If an entity has some relations as for model definition but it is created without them, the creation was throwing an error because it was trying to attach relations anyway.
I have created a new test file but the name is not really good I think
Changes