jobscraper/test/indeed.js

71 lines
1.4 KiB
JavaScript
Raw Normal View History

2020-05-19 09:05:04 +00:00
/**
* 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 IndeedScraper = require('../scrapers/indeed');
const indeedScraper = new IndeedScraper();
// const page = fs.readFileSync('data/indeed/indeed-2020-04-16--092311.html');
const page = fs.readFileSync('data/indeed/page2.html');
2020-08-24 08:35:30 +00:00
test.skip('Test Indeed scraper', async t => {
2020-06-01 08:25:13 +00:00
const $ = cheerio.load(page);
2020-05-19 09:05:04 +00:00
indeedScraper.loadPage($);
await indeedScraper.breakPage();
// await indeedScraper.getJobPages();
// console.log(await indeedScraper.checkNext());
// console.log(indeedScraper.items);
2020-07-21 11:05:01 +00:00
await indeedScraper.filterAdverts();
2020-05-19 09:05:04 +00:00
2020-08-24 08:35:30 +00:00
await indeedScraper.addToMongo();
2020-05-19 09:05:04 +00:00
t.end();
});
2020-07-21 11:05:01 +00:00
2020-08-24 08:35:30 +00:00
test.skip('Test full run Indeed scraper', async t => {
await indeedScraper.go('london').catch((err) => {
console.error('Indeed GO', err);
});
2020-07-21 11:05:01 +00:00
t.end();
});
2020-08-24 08:35:30 +00:00
test.test('Test Indeed scraper -- MONGO', 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.addToMongo();
t.end();
});