jobscraper/test/totaljobs.js

42 lines
996 B
JavaScript
Raw Permalink 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 TotaljobsScraper = require('../scrapers/totaljobs');
const totaljobsScraper = new TotaljobsScraper();
// const page = fs.readFileSync('data/indeed/indeed-2020-04-16--092311.html');
console.log(`${__dirname}`);
const page = fs.readFileSync(`${__dirname}/data/totaljobs/totaljobs-2020-04-16--121504.html`);
test.test('Test Totaljobs scraper', async t => {
2020-08-24 08:35:30 +00:00
const $ = cheerio.load(page);
2020-05-19 09:05:04 +00:00
2020-08-24 08:35:30 +00:00
totaljobsScraper.loadPage($);
2020-05-19 09:05:04 +00:00
2020-08-24 08:35:30 +00:00
await totaljobsScraper.breakPage();
2020-05-19 09:05:04 +00:00
2020-08-24 08:35:30 +00:00
await totaljobsScraper.getJobPages();
// console.log(await indeedScraper.checkNext());
2020-05-19 09:05:04 +00:00
2020-08-24 08:35:30 +00:00
// console.log(totaljobsScraper.items);
2020-05-19 09:05:04 +00:00
2020-08-24 08:35:30 +00:00
await totaljobsScraper.filterAdverts();
2020-05-19 09:05:04 +00:00
2020-08-24 08:35:30 +00:00
// await totaljobsScraper.addToDB();
2020-05-19 09:05:04 +00:00
2020-08-24 08:35:30 +00:00
t.end();
2020-05-19 09:05:04 +00:00
});