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, () => {
});
});
Inside the callback arguments, we would expect something like sum to come back:
it('should async add two numbers', () => {
utils.asyncAdd(4, 3, (sum) => {
});
});