Skip to content
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

Cannot mock non-string parameters #85

Open
jamierajewski opened this issue Nov 23, 2023 · 0 comments
Open

Cannot mock non-string parameters #85

jamierajewski opened this issue Nov 23, 2023 · 0 comments

Comments

@jamierajewski
Copy link

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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant