diff --git a/functions.js b/functions.js index 35cd411..eb9ddb4 100644 --- a/functions.js +++ b/functions.js @@ -15,5 +15,5 @@ function mapResponse(array = []) { } module.exports = { - mapResponse + mapResponse, }; diff --git a/index.js b/index.js index e5ff813..f4fe45d 100644 --- a/index.js +++ b/index.js @@ -38,12 +38,12 @@ function checkParams(input, period, interval, pointscount) { * @return {Promise} An array of arrays with date (timestamp) and values (number) properties */ async function callInvesting(pairId, period, interval, pointscount) { - const url = `https://api.investing.com/api/financialdata/${pairId}/historical/chart?period=${period}&interval=${interval}&pointscount=${pointscount}` + const url = `https://api.investing.com/api/financialdata/${pairId}/historical/chart?period=${period}&interval=${interval}&pointscount=${pointscount}`; const response = await fetch(url, { headers: new Headers({ - "upgrade-insecure-requests": "1" - }) + 'upgrade-insecure-requests': '1', + }), }); if (!response.ok) { @@ -51,7 +51,7 @@ async function callInvesting(pairId, period, interval, pointscount) { } const json = await response.json(); - return json.data + return json.data; } /** diff --git a/test/test.js b/test/test.js index 0946c55..e7b2180 100644 --- a/test/test.js +++ b/test/test.js @@ -11,7 +11,6 @@ const mockData = [ ]; describe('Tests for Investing.com unofficial APIs', () => { - it('should map an array of arrays to array of objects', () => { const mappedResponse = mapResponse(mockData); assert.strictEqual(mockData[0][0], mappedResponse[0].date); @@ -45,5 +44,4 @@ describe('Tests for Investing.com unofficial APIs', () => { const response = await investing('currencies/eur-usd', 'P1M', 'P1D', 20); assert.strictEqual(response, undefined); }); - });