sheetsj’s avatarsheetsj’s Twitter Archive—№ 3,636

          1. In which I learned that jest-when exists to make js tests more spock-like github.com/timkindberg/jest-when @KentBeck/1197177958504398849
        1. …in reply to @sheetsj
          Finally being able to do this in one line inJS is nice: when(fn).calledWith(1).mockReturnValue('yay!')
      1. …in reply to @sheetsj
        And the even more useful expect version: when(fn).expectCalledWith(1).mockReturnValue('x')
    1. …in reply to @sheetsj
      not quite spock-equivalent though, as you can't expect multiple calls in this fashion: when(fn).expectCalledWith(1).mockReturnValue('x') when(fn).expectCalledWith(2).mockReturnValue('y') one of them will fail
  1. …in reply to @sheetsj
    but the workaround isn't bad: when(fn) .calledWith(1).mockReturnValue('yay!') .calledWith(2).mockReturnValue('nay!') //do the test.... verifyAllWhenMocksCalled()