January 2018
Beginner
658 pages
13h 10m
English
Inside of the utils.test file, just under our previous test for utils.add, we'll add a new one for asyncAdd. The test setup will look really similar. We will be calling it and passing in a string as the first argument and a callback as the second argument. Then we'll add our callback, just like this:
it('should async add two numbers', () => {});
Inside the callback, we can get started calling utils.asyncAdd. We'll call it using utils.asyncAdd and we'll pass in those three arguments. We'll use 4 and 3, which should result in 7. And we'll provide the callback function, which should get called with that value, the value being 7:
it('should async add two numbers', () => { utils.asyncAdd(4, 3, () => { ...Read now
Unlock full access