I noticed that there doesn't seem to be a way to mock non-string parameters; for example, I have a function that calculates a duration to be used as the TTL for PExpire and does not expose it such that I can use it in my test. This means I cannot mock cases that call this function since there is no way to know the TTL at the time of test execution.
We have regex matching or a custom matcher function that are supported for string arguments, but there doesn't seem to be a way to mock non-string parameters.
Example:
// The key can be matched with regex but not the duration
mockConfig.Regexp().ExpectPExpire(`^[a-fA-F0-9]{32}/\d+$`, <some duration>).RedisNil()
I noticed that there doesn't seem to be a way to mock non-string parameters; for example, I have a function that calculates a duration to be used as the TTL for
PExpire
and does not expose it such that I can use it in my test. This means I cannot mock cases that call this function since there is no way to know the TTL at the time of test execution.We have regex matching or a custom matcher function that are supported for string arguments, but there doesn't seem to be a way to mock non-string parameters.
Example: