You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
None of the mocked functions are added to the mock client straight away though. They get attached to the client only after calling the addCommand() method, which matches the interface of the redis module. So in this case, the addCommand() would have to be called twice:
these 2 calls attach the predefined mock definitions into the mock client under 4 name variations:
mock.JSON_GET
mock.json_get
mock['json.get']
mock['JSON.GET']
Should the addCommand() be called with a parameter that does not have a mock definition, what should be linked to the attached method is a functions throwing an error stating "No mock definition provided for ${commandName}"
The text was updated successfully, but these errors were encountered:
As discussed in #157 the
redis-mock
needs to be extensible viaaddCommand()
andaddMockCommand()
.The
addMockCommand()
allows to define new logic for the mock in the following manner:None of the mocked functions are added to the mock client straight away though. They get attached to the client only after calling the
addCommand()
method, which matches the interface of theredis
module. So in this case, theaddCommand()
would have to be called twice:these 2 calls attach the predefined mock definitions into the mock client under 4 name variations:
mock.JSON_GET
mock.json_get
mock['json.get']
mock['JSON.GET']
Should the
addCommand()
be called with a parameter that does not have a mock definition, what should be linked to the attached method is a functions throwing an error stating "No mock definition provided for ${commandName}"The text was updated successfully, but these errors were encountered: