Skip to content

Cannot mock non-string parameters #85

@jamierajewski

Description

@jamierajewski

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions