41 lines
1.2 KiB
JavaScript
41 lines
1.2 KiB
JavaScript
const tape = require('tape');
|
|
const _test = require('tape-promise').default; // <---- notice 'default'
|
|
const test = _test(tape); // decorate tape
|
|
|
|
const fs = require('fs');
|
|
const jsonfile = require('jsonfile');
|
|
|
|
const cheerio = require('cheerio');
|
|
|
|
const Sweden = require('../ncas/se');
|
|
|
|
test('SWEDEN:: Scrape a Credit Instititute', async t => {
|
|
t.test('SWEDEN::Extract Details from Page', async t => {
|
|
const psDetail = fs.readFileSync('tests/data/se/ci001.html');
|
|
const expectedJSON = jsonfile.readFileSync('tests/data/se/ci001-detail.json');
|
|
|
|
const seScraper = new Sweden();
|
|
|
|
const output = await seScraper.extractEntity(psDetail);
|
|
|
|
t.deepEquals(output, expectedJSON, 'Extracted Details from Page');
|
|
|
|
t.end();
|
|
});
|
|
|
|
t.test('SWEDEN::Extract Cross Border Services from Page', async t => {
|
|
const psDetail = fs.readFileSync('tests/data/se/cross_border001.html');
|
|
const expectedJSON = jsonfile.readFileSync('tests/data/se/cross_border001.json');
|
|
|
|
const seScraper = new Sweden();
|
|
|
|
const output = await seScraper.extractCrossBorderServices(psDetail);
|
|
|
|
t.deepEquals(output, expectedJSON, 'Extracted Details from Page');
|
|
|
|
t.end();
|
|
});
|
|
|
|
t.end();
|
|
});
|