Skip to content

Instantly share code, notes, and snippets.

@edysegura
Last active August 29, 2015 14:26
Show Gist options
  • Save edysegura/9feab3b8becc05670216 to your computer and use it in GitHub Desktop.
Save edysegura/9feab3b8becc05670216 to your computer and use it in GitHub Desktop.
[JS] How to test many method calls in Jasmine
it('should test many calls', function() {
// GIVEN
spyOn(YourObject, 'yourMethod');
// WHEN
Something.happens();
// THEN
[
'HTML',
'CSS',
'JavaScript'
]
.forEach(function(status) {
expect(YourObject.yourMethod).toHaveBeenCalledWith(status);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment