-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
First off, I want to thank you for writing the book! It's packed with a lot of useful information. Observed one small thing while going through Chapter 8 - It talks about how it's very important (and rightly so!) for the fake to have the same shape as the original.
If the dependency is a function, the fake must have the same signature
Since fetch returns a Promise that resolves to the Response, the fake should also return a Promise. I think it would be more accurate for our fetchSpy to defined the following way:
// https://jasmine.github.io/api/edge/SpyStrategy.html#:~:text=3.5.0-,resolveTo(value),-Tell%20the%20spy
const fetchSpy = jasmine.createSpy('fetch').and.resolveTo(okResponse);
Metadata
Metadata
Assignees
Labels
No labels