jobscraper/test/indeedMobile.js
2020-07-21 12:05:01 +01:00

55 lines
1.4 KiB
JavaScript

/**
* Created by WebStorm.
* User: martin
* Date: 15/04/2020
* Time: 11:56
*/
const tape = require('tape');
const _test = require('tape-promise').default; // <---- notice 'default'
const test = _test(tape); // decorate tape
const fs = require('fs');
const cheerio = require('cheerio');
const IndeedMobileScraper = require('../scrapers/indeedMobile');
const indeedScraper = new IndeedMobileScraper();
// const page = fs.readFileSync('data/indeed/indeed-2020-04-16--092311.html');
const page = fs.readFileSync('data/indeed/indeed-mobile-index.html');
test.test('Test get as mobile', async t => {
indeedScraper.setStartUrl('https://www.indeed.co.uk/m/jobs?q=%28Html+or+Web+or+Sql+or+Delphi+or+Vb+or+Vbscript+or+Php+or+Ajax+or+Mysql+or+Sqlserver+or+Javascript+or+Nodejs+or+vuejs+or+sveltejs%29+-React&l=london&radius=0&jt=contract&rq=1&rsIdx=0&fromage=last&newcount=187');
await indeedScraper.getPage();
t.end();
});
test.skip('Test IndeedMobile scraper', async t => {
const $ = cheerio.load(page);
indeedScraper.loadPage($);
await indeedScraper.breakPage();
// await indeedScraper.getJobPages();
// console.log(await indeedScraper.checkNext());
// console.log(indeedScraper.items);
// await indeedScraper.filterAdverts();
// await indeedScraper.addToDB();
t.end();
});
test.skip('Test full run Indeed scraper', async t => {
await indeedScraper.go('london');
t.end();
});