Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/__mocks__/api/v3/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { default as company } from '~/__mocks__/fixtures/v3/company.js'
import { default as daily } from '~/__mocks__/fixtures/v3/daily.js'
import { default as quarter } from '~/__mocks__/fixtures/v3/quarter.js'

export class BuffettCodeApiClientV2 {
public mockCompany = jest.fn()
public mockDaily = jest.fn()
public mockQuarter = jest.fn()

constructor(readonly token: string) {
this.mockCompany.mockReturnValue(company)
this.mockDaily.mockReturnValue(daily)
this.mockQuarter.mockReturnValue(quarter)
}

company(ticker): object | null {
const company = this.mockCompany()[ticker]
return company ? company[0] : null
}

quarter(ticker): object | null {
const quarter = this.mockQuarter()[ticker]
return quarter ? quarter[0] : null
}

daily(ticker): object | null {
const daily = this.mockDaily()[ticker]
return daily ? daily[0] : null
}

ondemandQuarter(ticker): object | null {
const quarter = this.mockQuarter()[ticker]
return quarter ? quarter[0] : null
}
}
95 changes: 95 additions & 0 deletions src/__mocks__/fixtures/v3/company.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
module.exports = {
'data': {
tosyo_33category: 'サービス業',
url: 'http://corporate.kakaku.com/',
company_name: 'カカクコム',
company_name_en: 'Kakaku.com Inc.',
fiscal_month: 3.0,
established_date: '1997/12',
listing_date: '2003/10/09',
priority_market: 't1',
accounting_standard: 'IFRS',
latest_fiscal_year: 2020.0,
latest_fiscal_quarter: 1.0,
oldest_fiscal_year: 2008.0,
oldest_fiscal_quarter: 4.0,
fixed_tier_range: {
oldest_fiscal_year: 2015.0,
oldest_fiscal_quarter: 1.0,
latest_fiscal_year: 2020.0,
latest_fiscal_quarter: 1.0
}
},
column_description: {
tosyo_33category: {
name_jp: '東証33業種',
unit: 'なし'
},
url: {
name_jp: '会社URL',
unit: 'なし'
},
company_name: {
name_jp: '会社名',
unit: 'なし'
},
company_name_en: {
name_jp: '会社英名',
unit: 'なし'
},
fiscal_month: {
name_jp: '決算月',
unit: 'なし'
},
established_date: {
name_jp: '設立日',
unit: 'なし'
},
listing_date: {
name_jp: '上場日',
unit: 'なし'
},
priority_market: {
name_jp: '優先市場',
unit: 'なし'
},
accounting_standard: {
name_jp: '会計基準',
unit: 'なし'
},
latest_fiscal_year: {
name_jp: '直近決算年度',
unit: 'なし'
},
latest_fiscal_quarter: {
name_jp: '直近決算四半期',
unit: 'なし'
},
oldest_fiscal_year: {
name_jp: '取得可能な最古の決算年度',
unit: 'なし'
},
oldest_fiscal_quarter: {
name_jp: '取得可能な最古の決算四半期',
unit: 'なし'
},
fixed_tier_range: {
oldest_fiscal_year: {
name_jp: '定額利用可能な下限の決算年度',
unit: 'なし'
},
oldest_fiscal_quarter: {
name_jp: '定額利用可能な下限の決算四半期',
unit: 'なし'
},
latest_fiscal_year: {
name_jp: '定額利用可能な上限の決算年度',
unit: 'なし'
},
latest_fiscal_quarter: {
name_jp: '定額利用可能な上限の決算四半期',
unit: 'なし'
}
}
}
}
82 changes: 82 additions & 0 deletions src/__mocks__/fixtures/v3/daily-property.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
module.exports = {
cash_market_capital_ratio: {
name_jp: 'キャッシュ時価総額比率',
unit: '%'
},
debt_market_capital_ratio: {
name_jp: '有利子負債/時価総額比率',
unit: '倍'
},
dividend_yield_actual: {
name_jp: '配当利回り(実績)',
unit: '%'
},
dividend_yield_forecast: {
name_jp: '配当利回り(会社予想)',
unit: '%'
},
ebitda_forecast: {
name_jp: 'EBITDA(会社予想)',
unit: '百万円'
},
enterprise_value: {
name_jp: '企業価値',
unit: '百万円'
},
eps_forecast: {
name_jp: 'EPS(会社予想)',
unit: '円'
},
ev_ebitda_forecast: {
name_jp: 'EV/EBITDA(会社予想)',
unit: '倍'
},
ex_dividend: {
name_jp: '配当金(会社予想)',
unit: '円'
},
listing_years: {
name_jp: '上場年数',
unit: '年'
},
market_capital: {
name_jp: '時価総額',
unit: '百万円'
},
net_income_growth_rate_forecast: {
name_jp: '純利益成長率(直近年度実績→会社予想)',
unit: '%'
},
net_sales_growth_rate_forecast: {
name_jp: '売上高成長率(直近年度実績→会社予想)',
unit: '%'
},
operating_income_growth_rate_forecast: {
name_jp: '営業利益成長率(直近年度実績→会社予想)',
unit: '%'
},
pbr: {
name_jp: 'PBR',
unit: '倍'
},
pcfr_forecast: {
name_jp: 'PCFR',
unit: '倍'
},
per_forecast: {
name_jp: 'PER(会社予想)',
unit: '倍'
},
per_pbr: {
name_jp: 'PER×PBR',
unit: '単位無し'
},
psr_forecast: {
name_jp: 'PSR(会社予想)',
unit: '倍'
},
trading_volume: {
name_jp: '出来高',
unit: '株'
}
}
106 changes: 106 additions & 0 deletions src/__mocks__/fixtures/v3/daily.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
module.exports = {
column_description: {
cash_market_capital_ratio: {
name_jp: 'キャッシュ時価総額比率',
unit: '%'
},
debt_market_capital_ratio: {
name_jp: '有利子負債/時価総額比率',
unit: '倍'
},
dividend_yield_actual: {
name_jp: '配当利回り(実績)',
unit: '%'
},
dividend_yield_forecast: {
name_jp: '配当利回り(会社予想)',
unit: '%'
},
ebitda_forecast: {
name_jp: 'EBITDA(会社予想)',
unit: '百万円'
},
enterprise_value: {
name_jp: '企業価値',
unit: '百万円'
},
eps_forecast: {
name_jp: 'EPS(会社予想)',
unit: '円'
},
ev_ebitda_forecast: {
name_jp: 'EV/EBITDA(会社予想)',
unit: '倍'
},
ex_dividend: {
name_jp: '配当金(会社予想)',
unit: '円'
},
listing_years: {
name_jp: '上場年数',
unit: '年'
},
market_capital: {
name_jp: '時価総額',
unit: '百万円'
},
net_income_growth_rate_forecast: {
name_jp: '純利益成長率(直近年度実績→会社予想)',
unit: '%'
},
net_sales_growth_rate_forecast: {
name_jp: '売上高成長率(直近年度実績→会社予想)',
unit: '%'
},
operating_income_growth_rate_forecast: {
name_jp: '営業利益成長率(直近年度実績→会社予想)',
unit: '%'
},
pbr: {
name_jp: 'PBR',
unit: '倍'
},
pcfr_forecast: {
name_jp: 'PCFR',
unit: '倍'
},
per_forecast: {
name_jp: 'PER(会社予想)',
unit: '倍'
},
per_pbr: {
name_jp: 'PER×PBR',
unit: '単位無し'
},
psr_forecast: {
name_jp: 'PSR(会社予想)',
unit: '倍'
},
trading_volume: {
name_jp: '出来高',
unit: '株'
}
},
data: {
cash_market_capital_ratio: 4.98944759676063,
debt_market_capital_ratio: 1.48298604408628,
dividend_yield_actual: 1.40154169586545,
dividend_yield_forecast: 1.40154169586545,
ebitda_forecast: null,
enterprise_value: 567189541668.0,
eps_forecast: 0.0,
ev_ebitda_forecast: null,
ex_dividend: 40.0,
listing_years: 17.0,
market_capital: 587800541668.0,
net_income_growth_rate_forecast: -100.0,
net_sales_growth_rate_forecast: -100.0,
operating_income_growth_rate_forecast: -100.0,
pbr: 13.3959420603934,
pcfr_forecast: 182.603461220255,
per_forecast: null,
per_pbr: null,
psr_forecast: null,
trading_volume: 437700.0
}
}
Loading