73 lines
1.9 KiB
JavaScript
73 lines
1.9 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 Spain = require('../ncas/es');
|
|
|
|
const esScraper = new Spain();
|
|
|
|
const failure = { 'fail':true };
|
|
const empty = {};
|
|
|
|
test.test('Payment Services', async t => {
|
|
|
|
test.test('Spain:: Process PS Entity 001', async t => {
|
|
const htmlFile = 'tests/data/es/ps_001.html';
|
|
|
|
t.test('🇪🇸::Extract entity details', async t => {
|
|
const esDetail = fs.readFileSync(htmlFile, "latin1");
|
|
|
|
const expectedJSON = jsonfile.readFileSync('tests/data/es/ps_001.json');
|
|
|
|
const output = await esScraper.extractEntityDetails(esDetail);
|
|
|
|
t.deepEquals(output, expectedJSON, 'Extracted entity details from Page');
|
|
|
|
t.end();
|
|
});
|
|
|
|
t.end();
|
|
});
|
|
|
|
test.test('Spain:: Process PS Entity 002', async t => {
|
|
const htmlFile = 'tests/data/es/ps_002.html';
|
|
|
|
t.test('🇪🇸::Extract entity details', async t => {
|
|
const esDetail = fs.readFileSync(htmlFile, "latin1");
|
|
|
|
const expectedJSON = jsonfile.readFileSync('tests/data/es/ps_002.json');
|
|
|
|
const output = await esScraper.extractEntityDetails(esDetail);
|
|
|
|
t.deepEquals(output, expectedJSON, 'Extracted entity details from Page');
|
|
|
|
t.end();
|
|
});
|
|
|
|
t.end();
|
|
});
|
|
|
|
test.test('Spain:: Process PS Entity 003', async t => {
|
|
const htmlFile = 'tests/data/es/ps_003.html';
|
|
|
|
t.test('🇪🇸::Extract entity details', async t => {
|
|
const esDetail = fs.readFileSync(htmlFile, "latin1");
|
|
|
|
const expectedJSON = jsonfile.readFileSync('tests/data/es/ps_003.json');
|
|
|
|
const output = await esScraper.extractEntityDetails(esDetail);
|
|
|
|
t.deepEquals(output, expectedJSON, 'Extracted entity details from Page');
|
|
|
|
t.end();
|
|
});
|
|
|
|
t.end();
|
|
});
|
|
|
|
t.end();
|
|
});
|