jobscraper/test/totaljobs.js
2020-08-24 09:35:30 +01:00

42 lines
996 B
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 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 => {
const $ = cheerio.load(page);
totaljobsScraper.loadPage($);
await totaljobsScraper.breakPage();
await totaljobsScraper.getJobPages();
// console.log(await indeedScraper.checkNext());
// console.log(totaljobsScraper.items);
await totaljobsScraper.filterAdverts();
// await totaljobsScraper.addToDB();
t.end();
});