Skip to content

Commit

Permalink
#2 added specs for endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
chatman-media committed Dec 22, 2019
1 parent dcfd54f commit bb51123
Show file tree
Hide file tree
Showing 52 changed files with 409 additions and 10 deletions.
28 changes: 28 additions & 0 deletions scripts/generate.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
current_dir = Dir.pwd

dir = File.join current_dir, 'src', 'endpoints'

Dir[dir + '/**/*.ts'].each do |file|
next if file.include? '.spec.ts'

spec_file = file.gsub(/\.ts/, '.spec.ts')
next if File.exist?(spec_file)

name = file.match(/(\w+)\.ts/)[1]
next if name == 'index'

name[0] = name[0].downcase
puts name

File.open(spec_file, 'w') do |f|
f.write("import { #{name} } from './index';
describe('##{name}', () => {
test('call', async () => {
const result = await #{name}('AAPL');
expect(result).not.toEqual(null);
});
});
")
end
end
8 changes: 8 additions & 0 deletions src/endpoints/corporate-actions/BonusIssue.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { bonusIssue } from './index';

describe('#bonusIssue', () => {
test('call', async () => {
const result = await bonusIssue('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/corporate-actions/Distribution.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { distribution } from './index';

describe('#distribution', () => {
test('call', async () => {
const result = await distribution('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/corporate-actions/Dividends.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { dividends } from './index';

describe('#dividend', () => {
test('call', async () => {
const result = await dividends('AAPL');
expect(result).not.toEqual(null);
});
});
File renamed without changes.
8 changes: 8 additions & 0 deletions src/endpoints/corporate-actions/ReturnOfCapital.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { returnOfCapital } from './index';

describe('#returnOfCapital', () => {
test('call', async () => {
const result = await returnOfCapital('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/corporate-actions/RightsIssue.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { rightsIssue } from './index';

describe('#rightsIssue', () => {
test('call', async () => {
const result = await rightsIssue('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/corporate-actions/RightsToPurchase.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { rightsToPurchase } from './index';

describe('#rightsToPurchase', () => {
test('call', async () => {
const result = await rightsToPurchase('AAPL');
expect(result).not.toEqual(null);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { securityReclassification } from './index';

describe('#securityReclassification', () => {
test('call', async () => {
const result = await securityReclassification('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/corporate-actions/SecuritySwap.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { securitySwap } from './index';

describe('#securitySwap', () => {
test('call', async () => {
const result = await securitySwap('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/corporate-actions/Spinoff.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { spinoff } from './index';

describe('#spinoff', () => {
test('call', async () => {
const result = await spinoff('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/corporate-actions/Splits.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { splits } from './index';

describe('#split', () => {
test('call', async () => {
const result = await splits('AAPL');
expect(result).not.toEqual(null);
});
});
File renamed without changes.
4 changes: 2 additions & 2 deletions src/endpoints/corporate-actions/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export * from './BonusIssue';
export * from './Distribution';
export * from './Dividend';
export * from './Dividends';
export * from './ReturnOfCapital';
export * from './RightsIssue';
export * from './RightsToPurchase';
export * from './SecurityReclassification';
export * from './SecuritySwap';
export * from './Spinoff';
export * from './Split';
export * from './Splits';
8 changes: 8 additions & 0 deletions src/endpoints/guides/DataPoint.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { dataPoints } from './index';

describe('#dataPoint', () => {
test('call', async () => {
const result = await dataPoints('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/guides/TimeSeries.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { timeSeries } from './index';

describe('#timeSeries', () => {
test('call', async () => {
const result = await timeSeries();
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/news/News.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { news } from './index';

describe('#news', () => {
test('call', async () => {
const result = await news('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/reference-data/Search.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { search } from './index';

describe('#search', () => {
test('call', async () => {
const result = await search('AA');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/stock-fundamentals/BalanceSheet.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { balanceSheet } from './index';

describe('#balanceSheet', () => {
test('call', async () => {
const result = await balanceSheet('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/stock-fundamentals/CashFlow.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { cashflow } from './index';

describe('#cashflow', () => {
test('call', async () => {
const result = await cashflow('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/stock-fundamentals/DividendsBasic.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { dividendsBasic } from './index';

describe('#dividendsBasic', () => {
test('call', async () => {
const result = await dividendsBasic('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/stock-fundamentals/Earnings.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { earnings } from './index';

describe('#earnings', () => {
test('call', async () => {
const result = await earnings('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/stock-fundamentals/Financials.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { financials } from './index';

describe('#financials', () => {
test('call', async () => {
const result = await financials('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/stock-fundamentals/IncomeStatement.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { incomeStatement } from './index';

describe('#incomeStatement', () => {
test('call', async () => {
const result = await incomeStatement('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/stock-fundamentals/SplitsBasic.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { splitsBasic } from './index';

describe('#splitsBasic', () => {
test('call', async () => {
const result = await splitsBasic('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/stock-prices/Book.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { book } from './index';

describe('#book', () => {
test('call', async () => {
const result = await book('AAPL');
expect(result).not.toEqual(null);
});
});
9 changes: 8 additions & 1 deletion src/endpoints/stock-prices/Book.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { ApiRequest } from '../../core';
import { Quote } from './Quote';

// https://iexcloud.io/docs/api/#book
/**
* [Book](https://iexcloud.io/docs/api/#book)
*/
export const book = (symbol: string): Promise<Book> => {
return ApiRequest(`/stock/${symbol}/book`);
};

export interface Book {
readonly quote: Quote;
readonly bids: readonly BidOrAsk[];
Expand Down
8 changes: 8 additions & 0 deletions src/endpoints/stock-prices/DelayedQuote.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { delayedQuote } from './index';

describe('#delayedQuote', () => {
test('call', async () => {
const result = await delayedQuote('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/stock-prices/HistoricalPrice.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { historicalPrices } from './index';

describe('#historicalPrices', () => {
test('call', async () => {
const result = await historicalPrices('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/stock-prices/IntradayPrice.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { intradayPrices } from './index';

describe('#intradayPrices', () => {
test('call', async () => {
const result = await intradayPrices('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/stock-prices/LargestTrade.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { largestTrades } from './index';

describe('#largestTrades', () => {
test('call', async () => {
const result = await largestTrades('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/stock-prices/Ohlc.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { ohlc } from './index';

describe('#ohlc', () => {
test('call', async () => {
const result = await ohlc('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/stock-prices/PreviousDayPrice.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { previousDayPrice } from './index';

describe('#previousDayPrice', () => {
test('call', async () => {
const result = await previousDayPrice('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/stock-prices/PriceOnly.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { priceOnly } from './index';

describe('#priceOnly', () => {
test('call', async () => {
const result = await priceOnly('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/stock-prices/Quote.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { quote } from './index';

describe('#quote', () => {
test('call', async () => {
const result = await quote('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/stock-prices/VolumeByVenue.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { volumeByVenue } from './index';

describe('#volumeByVenue', () => {
test('call', async () => {
const result = await volumeByVenue('AAPL');
expect(result).not.toEqual(null);
});
});
2 changes: 1 addition & 1 deletion src/endpoints/stock-prices/VolumeByVenue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ApiRequest } from '../../core/ApiRequest';
* This returns 15 minute delayed and 30 day average consolidated volume percentage of a stock, by market. This call will always return 13 values, and will be sorted in ascending order by current day trading volume percentage.
* @param symbol
*/
export const VolumeByVenue = (symbol: string): Promise<VolumeByVenue> => {
export const volumeByVenue = (symbol: string): Promise<VolumeByVenue> => {
return ApiRequest(`stock/${symbol}/volume-by-venue`);
};

Expand Down
8 changes: 8 additions & 0 deletions src/endpoints/stock-profiles/Company.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { company } from './index';

describe('#company', () => {
test('call', async () => {
const result = await company('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/stock-profiles/InsiderRoster.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { insiderRoster } from './index';

describe('#insiderRoster', () => {
test('call', async () => {
const result = await insiderRoster('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/stock-profiles/InsiderSummary.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { insiderSummary } from './index';

describe('#insiderSummary', () => {
test('call', async () => {
const result = await insiderSummary('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/stock-profiles/InsiderTransactions.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { insiderTransactions } from './index';

describe('#insiderTransactions', () => {
test('call', async () => {
const result = await insiderTransactions('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/stock-profiles/Logo.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { logo } from './index';

describe('#logo', () => {
test('call', async () => {
const result = await logo('AAPL');
expect(result).not.toEqual(null);
});
});
8 changes: 8 additions & 0 deletions src/endpoints/stock-profiles/PeerGroups.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { peerGroups } from './index';

describe('#peerGroups', () => {
test('call', async () => {
const result = await peerGroups('AAPL');
expect(result).not.toEqual(null);
});
});
Loading

0 comments on commit bb51123

Please sign in to comment.