We're going to start much the same way. I'm actually going to copy these two lines from generateMessage to the generateLocationMessage test case:
expect(message.createdAt).toBeA('number');
expect(message).toInclude({from, text});
We're expecting the message.createdAt property to be a number which it should be, then we're expecting message to include a from property equal to Deb, and we're going to expect it to have a url property equal to the url string we defined:
describe('generateLocationMessage', () => {
it('should generate correct location object', () => {
var from = 'Deb';
var latitude = 15;
var longitude = 19;
var url = 'https://www.google.com/maps?q=15,19';
var message = generateLocationMessage(from, latitude, longitude);
expect(message.createdAt).toBeA('number');
expect(message).toInclude({from, url});
});
});
If both of these assertions pass then we know the object returned from generateLocationMessage is correct.