go-redis / redismock

Redis client Mock
https://redis.uptrace.dev
BSD 2-Clause "Simplified" License
272 stars 59 forks source link

How to allow ExpectSet multitimes/Anytimes? #42

Open cwsbobwang opened 1 year ago

cwsbobwang commented 1 year ago

Sometimes, it's not care about the times of call ExpectActions, how to allow it anytimes?

SteveFromAccounting commented 1 year ago

Curious about this as well. It seems like this functionality isn't implemented, looking at the struct here? Or did I just miss something?

The way I'm currently going about it is to always ensure I have the correct number of calls to an expected function, which means sometimes copy/pasting or putting an expectation in a loop, like so:

for i := 0; i < 5; i++ {
  // this is expected to be called 5 times
  redisClientMock.ExpectGet(myRedisKeys.TestKey).SetVal("true")
}
adibaulia commented 11 months ago

Looking forward to this feature. No requirement to anticipate the expiration time duration since my tested function computes the expired key's duration. Any updates available?