-
Notifications
You must be signed in to change notification settings - Fork 213
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
Support mocking Nexus operation with operation reference #1683
Support mocking Nexus operation with operation reference #1683
Conversation
It would be nice to have some tests using this new approach so we can see how it would be used. |
be8eb9e
to
d3f9212
Compare
@Quinn-With-Two-Ns Added a test using it. |
f6df7a0
to
3bb0bb9
Compare
d3f9212
to
a8478ba
Compare
a8478ba
to
7ffdf3b
Compare
} | ||
case testNexusOperationReference: | ||
// This case covers both nexus.RegisterableOperation and nexus.OperationReference. | ||
// All nexus.RegisterableOperation embeds nexus.UnimplementedOperation which |
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.
nit: may want to setup a check to enforce this in the Go SDK since the Nexus SDK is not stable , but I guess your unit test would fail so maybe redundant.
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.
Very minor comments left. I'll leave it up to @Quinn-With-Two-Ns to approve.
mockErr, | ||
)) | ||
} | ||
|
||
mockResult := mockRet[0] | ||
ret, ok := mockResult.(nexus.HandlerStartOperationResult[any]) | ||
result, ok := mockResult.(nexus.HandlerStartOperationResult[any]) |
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'm surprised this works in Go as nexus.HandlerStartOperationResult[T]
isn't assignable to nexus.HandlerStartOperationResult[any]
. But looks like your test below is passing.
4f6ada0
to
4540ab3
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.
Approved with comments. Nothing too major. Still want @Quinn-With-Two-Ns to do the last pass.
b0d19d6
to
33bb799
Compare
* Support mocking Nexus operation with operation reference * address comments * address comments
* Support for mocking nexus operations * address comments * add tests * add nexus events listeners * add test for nexus listeners * address comments * add assert nexus calls methods * address static checks * Support mocking Nexus operation with operation reference (#1683) * Support mocking Nexus operation with operation reference * address comments * address comments
What was changed
Support mocking Nexus operation using
nexus.OperationReference
.Why?
The user won't need to create a dummy implementation of Nexus operation to mock it.
Checklist
Closes
How was this tested: