honda-moto-scrape
Version:
this tool scrapes data for motos and scooters (from honda.es) site and returns them as JSON object
45 lines (44 loc) • 1.32 kB
JavaScript
const expect = require('chai').expect;
const cheerio = require('cheerio');
const Honda = require('../honda-scrape');
const fs = require('fs');
const debug = require('debug')('honda');
describe('honda motos', function () {
const honda = new Honda(cheerio, {concurrency: 3});
it.skip('should scrape get list of urls for groups of moto', function (done) {
this.timeout(5000);
honda.queryHondaSite().then(data => {
let motoLinks = honda.parseHondaData(data);
expect(motoLinks.length).to.be.above(0);
expect(motoLinks[0].indexOf('motorcycles/range/')).to.not.equal(-1);
done()
})
});
it.skip('should return list of specs for moto', function (done) {
this.timeout(10000);
honda.getSpecPages(true)
.then(data => {
// debug(data);
expect(data.length).to.be.above(0);
expect(data[0].indexOf('specifications')).to.not.equal(-1);
done()
}, err => debug(err))
});
it.skip('should return specifications', function (done) {
this.timeout(10000);
honda.scrapeSpecifications()
.then(data => {
debug(data);
done()
})
})
it('should return all the specs at once', function (done) {
this.timeout(30000);
honda.scrapeAll()
.then(data => {
expect(data.length).to.be.above(0);
expect(data[0]).to.have.any.keys(['url','volume','price'])
done()
})
})
});