当前位置:网站首页>Is it possible to use Jasmine's toHaveBeenCalledWith matcher with a regular expression?

Is it possible to use Jasmine's toHaveBeenCalledWith matcher with a regular expression?

2022-06-25 07:11:00 French red wine sweet

problem :

I have reviewed Jasmine's documentation of the toHaveBeenCalledWith matcher in order to understand whether it's possible to pass in a regular expression for an argument, if that argument is expected to be a string. I have reviewed Jasmine Of toHaveBeenCalledWith Matcher documentation , To see if you can pass regular expressions for parameters , If the parameter should be a string .Unfortunately, this is unsupported functionality. Unfortunately , This is an unsupported feature .There's also an issue open on github requesting this functionality. stay github There's another one on problem , Request this feature .

I've dug a bit into the codebase, and I see how it might be possible to implement this inside the existing matcher . I've dug up some code bases , I see how Existing matchers To achieve it .I think it would be more appropriate to implement it as a separate matcher though, so that the abstraction is captured individually. I think it is more appropriate to implement it as a separate matcher , This allows the abstraction to be captured separately .

In the meantime, what might be a good workaround? meanwhile , What might be a good solution ?


Solution :

Reference resources : https://stackoom.com/en/question/10Gqp
原网站

版权声明
本文为[French red wine sweet]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202201234252627.html