54 lines
1.6 KiB
JavaScript
54 lines
1.6 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 Italy = require('../ncas/it');
|
|
|
|
test('ITALY:: Scrape a Payment Service', async t => {
|
|
t.test('ITALY::Extract Registry Details from Page', async t => {
|
|
const psDetail = fs.readFileSync('tests/data/it/ps_detail001.html');
|
|
const expectedJSON = jsonfile.readFileSync('tests/data/it/ci001-detail.json');
|
|
|
|
const itScraper = new Italy();
|
|
|
|
const output = await itScraper.extractPSRegistry(psDetail);
|
|
|
|
t.deepEquals(output, expectedJSON, 'Extracted Details from Page');
|
|
|
|
t.end();
|
|
});
|
|
|
|
t.test('ITALY::Extract Registers Details from Page', async t => {
|
|
const psDetail = fs.readFileSync('tests/data/it/ps_detail002.html');
|
|
const expectedJSON = jsonfile.readFileSync('tests/data/it/ci002-detail.json');
|
|
|
|
const itScraper = new Italy();
|
|
|
|
const output = await itScraper.extractPSRegisters(psDetail);
|
|
|
|
t.deepEquals(output, expectedJSON, 'Extracted Details from Page');
|
|
|
|
t.end();
|
|
});
|
|
|
|
t.test('ITALY::Extract Authority Details from Page', async t => {
|
|
const psDetail = fs.readFileSync('tests/data/it/ps_detail003.html');
|
|
const expectedJSON = jsonfile.readFileSync('tests/data/it/ci003-detail.json');
|
|
|
|
const itScraper = new Italy();
|
|
|
|
const output = await itScraper.extractPSAuthority(psDetail);
|
|
|
|
t.deepEquals(output, expectedJSON, 'Extracted Details from Page');
|
|
|
|
t.end();
|
|
});
|
|
|
|
t.end();
|
|
});
|