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('LANGUAGE:: Scrape a Credit Instititute', async t => { t.test('JSON Stingify and back', async t => { const psDetail = jsonfile.readFileSync('tests/data/lang.se.json'); const expectedJSON = jsonfile.readFileSync('tests/data/lang.se.json'); const dictionary = new Map(psDetail); const arrayedMap = JSON.stringify([...dictionary]); const output = JSON.parse(arrayedMap); // console.log(output); t.deepEquals(output, expectedJSON, 'JSON Matches'); t.end(); }); t.test('JSON Stingify -> Buffer and back', async t => { const psDetail = jsonfile.readFileSync('tests/data/lang.se.json'); const expectedJSON = jsonfile.readFileSync('tests/data/lang.se.json'); const dictionary = new Map(psDetail); const arrayedMap = JSON.stringify([...dictionary]); const base64data = new Buffer.from(arrayedMap); const str = base64data.toString(); const output = JSON.parse(str); // console.log(output); t.deepEquals(output, expectedJSON, 'JSON Matches'); t.end(); }); t.end(); });