diff --git a/test/image.test.js b/test/image.test.js new file mode 100644 index 0000000..8ca41ec --- /dev/null +++ b/test/image.test.js @@ -0,0 +1,23 @@ +require('dotenv').config(); +const Diffbot = require('../src/diffbot.js'); +const diffbot = new Diffbot(process.env.DIFFBOT_API_TOKEN); +const expect = require('chai').expect; + +describe('Image Tests', function() { + + this.timeout(15 * 1000); + + it('should find the posted image', async () => { + + const image = await diffbot.image({ + url: 'https://www.google.com/', + body: '

This is the Google logo

' + }); + + expect(image.objects).to.be.an('array'); + expect(image.objects.length).to.be.greaterThan(0); + expect(image.objects[0].url).to.equal('https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png'); + + return Promise.resolve(true); + }); +});