-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: spies #162
feat: spies #162
Conversation
b9d7beb
to
6789397
Compare
…dd toBeCalledWithArgs(), and toBeCalledWithoutArgs()
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.
one comment, but no biggie, overral LGTM :D Some really nice code here, of course didnt check jest generated, and im happy if you think you've hit enough during the tesst
@@ -99,6 +99,7 @@ export class MockBuilder<ClassToMock> extends TestDoubleBuilder<ClassToMock> { | |||
value: (...args: unknown[]) => { | |||
// Track that this method was called | |||
mock.calls[method]++; | |||
// TODO: copy spy approach because we need mock.expected_args |
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.
missed todo? not sure if this is crucial or could be done later down the line
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.
…(unexpected arg is the actual arg)
… are not yet implemented properly)
Closes #151
TODO
VerificationError
tests/cjs
andtests/esm
FunctionExpressionVerifier
MethodVerifier
drashland/webiste-v2
repo (feat(rhum/v2.x): spies website-v2#158)Summary
const spyClass = Spy(SomeClass)
const spyMethod = Spy(obj, "nameOfMethod", optionalReturnValue)
const spyMethod = Spy(func, optionalReturnValue)
FunctionExpressionVerifier
for Spy stub call verificationCallableVerifier
thatMethodVerifier
can extendFunctionExpressionVerifier
for Spy stubs and theMethodVerifier
used between theMock
and theSpy
test doublesVerificationError
class (formerlyMethodVerificationError
)ignoredLines
array so that we don't accidentally show a random file.CallableVerifier
) to reduce the amount of duplicated code.MethodArguments
type)MethodCalls
is nowMockMethodCalls
because it only pertains to mocks.IMock.calls
".