Add test for findFirst returning null#740
Open
atadeuccislideworks wants to merge 1 commit intomorintd:masterfrom
Open
Add test for findFirst returning null#740atadeuccislideworks wants to merge 1 commit intomorintd:masterfrom
atadeuccislideworks wants to merge 1 commit intomorintd:masterfrom
Conversation
Owner
|
Hello @atadeuccislideworks , thanks for submission, I'll have a look in the next few days! 🙏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey, this test is actually falling, I tried my hardest to make it work but I don't understand fully the codebase.
find › findFirst › Should not return item expect(received).toEqual(expected) // deep equality Expected: null Received: {"authorId": 2, "blogId": 2, "createdAt": 2024-01-09T18:59:57.960Z, "id": 2, "imprint": "3e937a1f-cd50-422f-bd0d-624d9ccd441d", "title": "title2"} 111 | 112 | expect(realPost).toEqual(null); > 113 | expect(mockPost).toEqual(null); | ^ 114 | });I think the issue is somewhere near
prismock/src/lib/operations/find/match.ts
Line 77 in 3e74dd2
Changing the output of getFieldRelationshipWhere to:
made my new test pass but broke
find-nested.test.tsand some other tests, with this changeprismock/src/lib/operations/find/match.ts
Line 79 in 3e74dd2
returns
{ id: 1, authorId: 2 }, without the change it returns only{ id : 2 }becausegetFieldRelationshipWhereoverrides theObject.assign({}, childWhere)since it's the same key id.@morintd if you have some idea on how to fix the nested find now, I would love to submit it into this PR