I like to follow the test pattern of given, when, then. This pattern makes using a syntax using when unintuitive in the given block (which is where this library would be used).
I have created aliases for the supported functionality in a fork, which look like this:
The exports WhenMock, verifyAllWhenMocksCalled and resetAllWhenMocks are aliased to GivenMock, verifyAllGivenMocksCalled and resetAllGivenMocks respectively.
It would also "fix" the linguistic problems #24 mentions by allowing given(..).returns(..).
In my implementation the two syntaxes can be combined in any way, which allows for calls like given(..).calledWith(..).mockReturnValue(..). However, it should be relatively simply to disallow this, and I'd be happy to do so.
Is this something you'd be interested in supporting?
I like to follow the test pattern of
given
,when
,then
. This pattern makes using a syntax usingwhen
unintuitive in thegiven
block (which is where this library would be used).I have created aliases for the supported functionality in a fork, which look like this:
This works with
expectCalledWith
too, of course.The exports
WhenMock
,verifyAllWhenMocksCalled
andresetAllWhenMocks
are aliased toGivenMock
,verifyAllGivenMocksCalled
andresetAllGivenMocks
respectively.It would also "fix" the linguistic problems #24 mentions by allowing
given(..).returns(..)
.In my implementation the two syntaxes can be combined in any way, which allows for calls like
given(..).calledWith(..).mockReturnValue(..)
. However, it should be relatively simply to disallow this, and I'd be happy to do so.Is this something you'd be interested in supporting?