const swedishWord = require('./swedishword.js'); test('Test swedishword', () => { return swedishWord.getSwedishWord() .then((d) => { console.log('Swedish result: ', JSON.stringify(d)); console.log(d.xml.words.language); //expect(d.xml.words.language).toEqual('Swedish'); }) .catch((e)=> { 'use strict'; expect(e).toBeNull(); }); done(); });