added scraper test
This commit is contained in:
parent
819f6704eb
commit
b43a54c0e4
BIN
db/jobs.db
BIN
db/jobs.db
Binary file not shown.
BIN
db/jobstest.db
Normal file
BIN
db/jobstest.db
Normal file
Binary file not shown.
@ -36,4 +36,17 @@ left join read on read.rid = jobs._id
|
||||
left join applied on applied.aid = jobs._id
|
||||
|
||||
order by jobs._id desc;
|
||||
|
||||
DROP TABLE IF EXISTS "accounts";
|
||||
CREATE TABLE IF NOT EXISTS "accounts" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,
|
||||
"username" TEXT NOT NULL,
|
||||
"password" TEXT NOT NULL,
|
||||
"email" TEXT NOT NULL
|
||||
);
|
||||
INSERT INTO accounts VALUES(1,'bob','plop','bob@plop.com');
|
||||
INSERT INTO accounts VALUES(2,'martin','MPReoa43','martind2000@gmail.com');
|
||||
|
||||
INSERT INTO sqlite_sequence VALUES('accounts',2);
|
||||
|
||||
COMMIT;
|
||||
|
1222
db/jobstest2.db.sql
Normal file
1222
db/jobstest2.db.sql
Normal file
File diff suppressed because one or more lines are too long
BIN
db/jobtest.db
Normal file
BIN
db/jobtest.db
Normal file
Binary file not shown.
@ -38,6 +38,17 @@ test.test('Test Indeed scraper', async t => {
|
||||
// await indeedScraper.addToDB();*/
|
||||
|
||||
await indeedScraper.go('london');
|
||||
await totaljobsScraper.go('london');
|
||||
await cwjobsScraper.go('london');
|
||||
await indeedScraper.go('glasgow');
|
||||
await totaljobsScraper.go('glasgow');
|
||||
await cwjobsScraper.go('glasgow');
|
||||
await indeedScraper.go('edinburgh');
|
||||
await totaljobsScraper.go('edinburgh');
|
||||
await cwjobsScraper.go('edinburgh');
|
||||
await indeedScraper.go('milton keynes');
|
||||
await totaljobsScraper.go('milton keynes');
|
||||
await cwjobsScraper.go('milton keynes');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
39
test/testscrapers.js
Normal file
39
test/testscrapers.js
Normal file
@ -0,0 +1,39 @@
|
||||
/**
|
||||
* 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 TotaljobsScraper = require('../scrapers/totaljobs');
|
||||
const CwjobsScraper = require('../scrapers/cwjobs');
|
||||
|
||||
const indeedScraper = new IndeedScraper();
|
||||
const totaljobsScraper = new TotaljobsScraper();
|
||||
const cwjobsScraper = new CwjobsScraper();
|
||||
|
||||
test.test('Test Indeed scraper', async t => {
|
||||
await indeedScraper.go('london');
|
||||
await totaljobsScraper.go('london');
|
||||
await cwjobsScraper.go('london');
|
||||
await indeedScraper.go('glasgow');
|
||||
await totaljobsScraper.go('glasgow');
|
||||
await cwjobsScraper.go('glasgow');
|
||||
await indeedScraper.go('edinburgh');
|
||||
await totaljobsScraper.go('edinburgh');
|
||||
await cwjobsScraper.go('edinburgh');
|
||||
await indeedScraper.go('milton keynes');
|
||||
await totaljobsScraper.go('milton keynes');
|
||||
await cwjobsScraper.go('milton keynes');
|
||||
|
||||
t.end();
|
||||
});
|
Loading…
Reference in New Issue
Block a user