[ 2 posts ]

Naga Malepati

  • Username: mnaga
  • Joined: Tue Mar 20, 2012 11:23 am
  • Posts: 2
  • Offline
  • Profile

Multiple calls with Y.Mock

Post Posted: Tue Mar 20, 2012 11:29 am
+0-
I see Y.Mock has a callcount property which can be set in the expectation for verifying that the method is being called multiple times.
But apparently, it seems there is no way to pass multiple sets of arguments to the expectation. I'd like to test calls to the same method multiple times with different arguments (likely candidate Y.Base's set, on methods).

Naga Malepati

  • Username: mnaga
  • Joined: Tue Mar 20, 2012 11:23 am
  • Posts: 2
  • Offline
  • Profile

Re: Multiple calls with Y.Mock

Post Posted: Tue Mar 20, 2012 11:50 am
+0-
Nevermind. It seems the expectation is to use a custom run function to verify the arguments.

Got it to work by

Y.Mock.expect(mockView, {
method: 'on',
callCount : 2,
run: onVerify,
args: [Y.Mock.Value.String, Y.Mock.Value.Any, Y.Mock.Value.Any]
});

And moving the verification of actual values in onVerify, method.

But was wondering expectation.args could be an array of arguments instead
  [ 2 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum