假设我有
spyOn($cookieStore,'get').and.returnValue('abc');
这对我的用例来说太笼统了。我们随时打电话
$cookieStore.get('someValue') --> returns 'abc'
$cookieStore.get('anotherValue') --> returns 'abc'
我想设置一个spyOn,所以我根据参数得到不同的回报:
$cookieStore.get('someValue') --> returns 'someabc'
$cookieStore.get('anotherValue') --> returns 'anotherabc'
有什么建议么?