Skip to content

Commit

Permalink
fixed failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nielse63 committed Jan 12, 2023
1 parent 02f00e8 commit 2d613e6
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 114 deletions.
6 changes: 4 additions & 2 deletions docs/api/finviz.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
- [Installation](#installation)
- [Usage](#usage)
- [API](#api)
- [finviz.quote(symbol) ⇒ <code>Promise</code>](#finvizquotesymbol--promise)
- [finviz.screener(url) ⇒ <code>Promise</code>](#finvizscreenerurl--promise)
- [finviz.quote(symbol) ⇒ Promise](#finvizquotesymbol--promise)
- [finviz.screener(url) ⇒ Promise](#finvizscreenerurl--promise)
- [Response schema](#response-schema)

## Features
Expand Down Expand Up @@ -94,6 +94,8 @@ const symbols = await finviz.screener(

## Response schema

<!-- TODO: update this schedma -->

```js
// pulled from https://finviz.com/quote.ashx?t=AACG
{
Expand Down
110 changes: 55 additions & 55 deletions packages/finviz/lib/__tests__/quote.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,76 +2,76 @@ const quote = require('../quote');

const symbol = 'AACG';
const expectedKeys = [
'index',
'pE',
'52WHigh',
'52WLow',
'52WRange',
'atr',
'avgVolume',
'beta',
'bookSh',
'cashSh',
'change',
'currentRatio',
'debtEq',
'dividend',
'earnings',
'employees',
'epsNext5Y',
'epsNextQ',
'epsNextY',
'epsPast5Y',
'epsQQ',
'epsThisY',
'epsTtm',
'insiderOwn',
'shsOutstand',
'perfWeek',
'marketCap',
'forwardPE',
'epsNextY',
'insiderTrans',
'shsFloat',
'perfMonth',
'grossMargin',
'income',
'peg',
'epsNextQ',
'index',
'insiderOwn',
'insiderTrans',
'instOwn',
'shortFloat',
'perfQuarter',
'sales',
'pS',
'epsThisY',
'instTrans',
'shortRatio',
'perfHalfY',
'bookSh',
'ltDebtEq',
'marketCap',
'operMargin',
'optionable',
'pB',
'roa',
'targetPrice',
'perfYear',
'cashSh',
'pC',
'epsNext5Y',
'roe',
'52WRange',
'perfYtd',
'dividend',
'pE',
'pFcf',
'epsPast5Y',
'roi',
'52WHigh',
'beta',
'pS',
'payout',
'peg',
'perfHalfY',
'perfMonth',
'perfQuarter',
'perfWeek',
'perfYear',
'perfYtd',
'prevClose',
'price',
'profitMargin',
'quickRatio',
'recom',
'relVolume',
'roa',
'roe',
'roi',
'rsi14',
'sales',
'salesPast5Y',
'grossMargin',
'52WLow',
'atr',
'employees',
'currentRatio',
'salesQQ',
'operMargin',
'rsi14',
'volatility',
'optionable',
'debtEq',
'epsQQ',
'profitMargin',
'relVolume',
'prevClose',
'shortFloatRatio',
'shortInterest',
'shortable',
'ltDebtEq',
'earnings',
'payout',
'avgVolume',
'price',
'recom',
'shsFloat',
'shsOutstand',
'sma20',
'sma50',
'sma200',
'sma50',
'targetPrice',
'volatility',
'volume',
'change',
];

describe('quote', () => {
Expand Down
115 changes: 58 additions & 57 deletions packages/quote/__tests__/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,76 +1,77 @@
const quote = require('..');

const symbol = 'MSFT';
const expectedKeys = [
'index',
'pE',
'52WHigh',
'52WLow',
'52WRange',
'atr',
'avgVolume',
'beta',
'bookSh',
'cashSh',
'change',
'currentRatio',
'debtEq',
'dividend',
'earnings',
'employees',
'epsNext5Y',
'epsNextQ',
'epsNextY',
'epsPast5Y',
'epsQQ',
'epsThisY',
'epsTtm',
'insiderOwn',
'shsOutstand',
'perfWeek',
'marketCap',
'forwardPE',
'epsNextY',
'insiderTrans',
'shsFloat',
'perfMonth',
'grossMargin',
'income',
'peg',
'epsNextQ',
'index',
'insiderOwn',
'insiderTrans',
'instOwn',
'shortFloat',
'perfQuarter',
'sales',
'pS',
'epsThisY',
'instTrans',
'shortRatio',
'perfHalfY',
'bookSh',
'ltDebtEq',
'marketCap',
'operMargin',
'optionable',
'pB',
'roa',
'targetPrice',
'perfYear',
'cashSh',
'pC',
'epsNext5Y',
'roe',
'52WRange',
'perfYtd',
'dividend',
'pE',
'pFcf',
'epsPast5Y',
'roi',
'52WHigh',
'beta',
'pS',
'payout',
'peg',
'perfHalfY',
'perfMonth',
'perfQuarter',
'perfWeek',
'perfYear',
'perfYtd',
'prevClose',
'price',
'profitMargin',
'quickRatio',
'recom',
'relVolume',
'roa',
'roe',
'roi',
'rsi14',
'sales',
'salesPast5Y',
'grossMargin',
'52WLow',
'atr',
'employees',
'currentRatio',
'salesQQ',
'operMargin',
'rsi14',
'volatility',
'optionable',
'debtEq',
'epsQQ',
'profitMargin',
'relVolume',
'prevClose',
'shortFloatRatio',
'shortInterest',
'shortable',
'ltDebtEq',
'earnings',
'payout',
'avgVolume',
'price',
'recom',
'shsFloat',
'shsOutstand',
'sma20',
'sma50',
'sma200',
'sma50',
'targetPrice',
'volatility',
'volume',
'change',
];

describe('@stonksjs/quote', () => {
Expand All @@ -79,12 +80,12 @@ describe('@stonksjs/quote', () => {
});

it('should return an object', async () => {
const response = await quote('MSFT');
const response = await quote(symbol);
expect(response).toBeObject();
});

it('response should have all expected keys', async () => {
const response = await quote('MSFT');
const response = await quote(symbol);
expect(response).toContainKeys(expectedKeys);
});
});

0 comments on commit 2d613e6

Please sign in to comment.