-1

Using Chai or mocha, how can I see whether an image exists. For example, https://upload.wikimedia.org/wikipedia/commons/5/51/Google.png

1 Answers1

1

Probably chai http plugin:

it('should check image', function(done) {
  chai.request('https://upload.wikimedia.org')
  .get('/wikipedia/commons/5/51/Google.png')
  .end(function(err, res) {
    expect(res).to.have.status(200);
    done();                               
  });
});
Alejandro
  • 5,834
  • 1
  • 19
  • 36