Jasmine Spies

Sami C.
1 min readFeb 6, 2019

--

What is a jasmine spy?

A spy is generally used to “mock” a function or object, so that you can track its implementation.

When Should you Mock?

Quite often you’ll see a function executing an API call and returning data.

This is not trivial when testing, because in unit tests we are more interested in testing the functionality instead of testing whether an external service works.

How to mock our getMovies function?

There are several ways

More Information can be found on jasmine official introduction

--

--

Sami C.
Sami C.

Written by Sami C.

Freelance Software Engineer

Responses (1)