53 lines
1.6 KiB
JavaScript
53 lines
1.6 KiB
JavaScript
const tape = require('tape');
|
|
const _test = require('tape-promise').default; // <---- notice 'default'
|
|
const test = _test(tape); // decorate tape
|
|
|
|
const diff = require('deep-diff');
|
|
const fs = require('fs');
|
|
const jsonfile = require('jsonfile');
|
|
|
|
const Austria = require('../ncas/at');
|
|
|
|
const atScraper = new Austria();
|
|
|
|
test.test('Austria 🇦🇹 :: Tests', async t => {
|
|
|
|
t.test('Test extractEntityDetails ent_001', async t => {
|
|
const html = fs.readFileSync('tests/data/at/ent_001.html');
|
|
const output = await atScraper.extractEntityDetails(html);
|
|
const expectedJSON = jsonfile.readFileSync('tests/data/at/ent_001.json');
|
|
|
|
t.deepEquals(output, expectedJSON, 'Extracted entity details from Page');
|
|
|
|
console.log(diff(output, expectedJSON));
|
|
|
|
t.end();
|
|
});
|
|
|
|
t.test('Test extractEntityDetails ent_002', async t => {
|
|
const html = fs.readFileSync('tests/data/at/ent_002.html');
|
|
const output = await atScraper.extractEntityDetails(html);
|
|
const expectedJSON = jsonfile.readFileSync('tests/data/at/ent_002.json');
|
|
|
|
t.deepEquals(output, expectedJSON, 'Extracted entity details from Page');
|
|
|
|
console.log(diff(output, expectedJSON));
|
|
|
|
t.end();
|
|
});
|
|
|
|
t.test('Test extractEntityDetails ent_003', async t => {
|
|
const html = fs.readFileSync('tests/data/at/ent_003.html');
|
|
const output = await atScraper.extractEntityDetails(html);
|
|
const expectedJSON = jsonfile.readFileSync('tests/data/at/ent_003.json');
|
|
|
|
t.deepEquals(output, expectedJSON, 'Extracted entity details from Page');
|
|
|
|
console.log(diff(output, expectedJSON));
|
|
|
|
t.end();
|
|
});
|
|
|
|
t.end();
|
|
});
|