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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { default as company } from '../fixtures/company.js'
import { default as indicator } from '../fixtures/indicator.js'
import { default as quarter } from '../fixtures/quarter.js'
import { default as company } from '../../fixtures/v2/company.js'
import { default as indicator } from '../../fixtures/v2/indicator.js'
import { default as quarter } from '../../fixtures/v2/quarter.js'

export class BuffettCodeApiClientV2 {
public mockCompany = jest.fn()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { default as indicator } from '../fixtures/indicator-property'
import { default as indicator } from '../../fixtures/v2/indicator-property'

export class IndicatorProperty {
static fetch(): object {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { default as quarter } from '../fixtures/quarter-property'
import { default as quarter } from '../../fixtures/v2/quarter-property'

export class QuarterProperty {
static fetch(): object {
Expand Down
4 changes: 2 additions & 2 deletions src/api/company-service.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { CompanyService } from './company-service'
import { CachingBuffettCodeApiClientV2 } from '../api/caching-client'
import { CachingBuffettCodeApiClientV2 } from './v2/caching-client'
import { YearQuarter } from '../fiscal-periods/year-quarter'
import { YearQuarterParam } from '../fiscal-periods/year-quarter-param'

jest.mock('../api/client', () => jest.requireActual('../__mocks__/api/client'))
jest.mock('./v2/client', () => jest.requireActual('../__mocks__/api/v2/client'))
jest.mock('../services/company-cache', () =>
jest.requireActual('../__mocks__/services/company-cache')
)
Expand Down
2 changes: 1 addition & 1 deletion src/api/company-service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BuffettCodeApiClientV2 } from '../api/client'
import { BuffettCodeApiClientV2 } from './v2/client'
import { YearQuarter } from '../fiscal-periods/year-quarter'
import { YearQuarterParam } from '../fiscal-periods/year-quarter-param'

Expand Down
4 changes: 2 additions & 2 deletions src/api/ondemand-api-period-range.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { CachingBuffettCodeApiClientV2 } from './caching-client'
import { CachingBuffettCodeApiClientV2 } from './v2/caching-client'
import { CompanyService } from './company-service'
import { OndemandApiPeriodRange } from './ondemand-api-period-range'
import { YearQuarter } from '../fiscal-periods/year-quarter'
import { YearQuarterRange } from '../fiscal-periods/year-quarter-range'

jest.mock('../api/client', () => jest.requireActual('../__mocks__/api/client'))
jest.mock('./v2/client', () => jest.requireActual('../__mocks__/api/v2/client'))
jest.mock('../services/company-cache', () =>
jest.requireActual('../__mocks__/services/company-cache')
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { CachingBuffettCodeApiClientV2 } from './caching-client'
import { YearQuarter } from '../fiscal-periods/year-quarter'
import { YearQuarterParam } from '../fiscal-periods/year-quarter-param'
import { CompanyCache } from '../__mocks__/services/company-cache'
import { IndicatorCache } from '../services/indicator-cache'
import { QuarterCache } from '../__mocks__/services/quarter-cache'

jest.mock('./client', () => jest.requireActual('../__mocks__/api/client'))
jest.mock('../services/company-cache', () =>
jest.requireActual('../__mocks__/services/company-cache')
import { YearQuarter } from '../../fiscal-periods/year-quarter'
import { YearQuarterParam } from '../../fiscal-periods/year-quarter-param'
import { CompanyCache } from '../../__mocks__/services/company-cache'
import { IndicatorCache } from '../../services/indicator-cache'
import { QuarterCache } from '../../__mocks__/services/quarter-cache'

jest.mock('./client', () => jest.requireActual('../../__mocks__/api/v2/client'))
jest.mock('../../services/company-cache', () =>
jest.requireActual('../../__mocks__/services/company-cache')
)
jest.mock('../services/indicator-cache', () =>
jest.requireActual('../__mocks__/services/indicator-cache')
jest.mock('../../services/indicator-cache', () =>
jest.requireActual('../../__mocks__/services/indicator-cache')
)
jest.mock('../services/quarter-cache', () =>
jest.requireActual('../__mocks__/services/quarter-cache')
jest.mock('../../services/quarter-cache', () =>
jest.requireActual('../../__mocks__/services/quarter-cache')
)

describe('company', () => {
Expand Down
8 changes: 4 additions & 4 deletions src/api/caching-client.ts → src/api/v2/caching-client.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { BuffettCodeApiClientV2 } from './client'
import { YearQuarterParam } from '../fiscal-periods/year-quarter-param'
import { CompanyCache } from '../services/company-cache'
import { IndicatorCache } from '../services/indicator-cache'
import { QuarterCache } from '../services/quarter-cache'
import { YearQuarterParam } from '../../fiscal-periods/year-quarter-param'
import { CompanyCache } from '../../services/company-cache'
import { IndicatorCache } from '../../services/indicator-cache'
import { QuarterCache } from '../../services/quarter-cache'

export class CachingBuffettCodeApiClientV2 extends BuffettCodeApiClientV2 {
constructor(token: string) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { CachingIndicatorProperty } from './caching-indicator-property'
import { IndicatorPropertyCache } from '../services/indicator-property-cache'
import { IndicatorPropertyCache } from '../../services/indicator-property-cache'

jest.mock('../api/indicator-property', () =>
jest.requireActual('../__mocks__/api/indicator-property')
jest.mock('./indicator-property', () =>
jest.requireActual('../../__mocks__/api/v2/indicator-property')
)

jest.mock('../services/indicator-property-cache', () =>
jest.requireActual('../__mocks__/services/indicator-property-cache')
jest.mock('../../services/indicator-property-cache', () =>
jest.requireActual('../../__mocks__/services/indicator-property-cache')
)

describe('fetch', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IndicatorProperty } from './indicator-property'
import { IndicatorPropertyCache } from '../services/indicator-property-cache'
import { IndicatorPropertyCache } from '../../services/indicator-property-cache'

export class CachingIndicatorProperty extends IndicatorProperty {
static fetch(): object {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { CachingQuarterProperty } from './caching-quarter-property'
import { QuarterPropertyCache } from '../services/quarter-property-cache'
import { QuarterPropertyCache } from '../../services/quarter-property-cache'

jest.mock('../api/quarter-property', () =>
jest.requireActual('../__mocks__/api/quarter-property')
jest.mock('./quarter-property', () =>
jest.requireActual('../../__mocks__/api/v2/quarter-property')
)

jest.mock('../services/quarter-property-cache', () =>
jest.requireActual('../__mocks__/services/quarter-property-cache')
jest.mock('../../services/quarter-property-cache', () =>
jest.requireActual('../../__mocks__/services/quarter-property-cache')
)

describe('fetch', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { QuarterProperty } from './quarter-property'
import { QuarterPropertyCache } from '../services/quarter-property-cache'
import { QuarterPropertyCache } from '../../services/quarter-property-cache'

export class CachingQuarterProperty extends QuarterProperty {
static fetch(): object {
Expand Down
12 changes: 6 additions & 6 deletions src/api/client.test.ts → src/api/v2/client.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { BuffettCodeApiClientV2 } from './client'
import { HttpError } from './http-error'
import { YearQuarterParam } from '../fiscal-periods/year-quarter-param'
import { useMockedUrlFetchApp } from './test-helper'
import * as company from '../__mocks__/fixtures/company'
import * as indicator from '../__mocks__/fixtures/indicator'
import * as quarter from '../__mocks__/fixtures/quarter'
import { HttpError } from '../http-error'
import { YearQuarterParam } from '../../fiscal-periods/year-quarter-param'
import { useMockedUrlFetchApp } from '../test-helper'
import * as company from '../../__mocks__/fixtures/v2/company'
import * as indicator from '../../__mocks__/fixtures/v2/indicator'
import * as quarter from '../../__mocks__/fixtures/v2/quarter'

test('HttpError#isInvalidTestingRequest', () => {
const res1 = useMockedUrlFetchApp(
Expand Down
6 changes: 3 additions & 3 deletions src/api/client.ts → src/api/v2/client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { YearQuarterParam } from '../fiscal-periods/year-quarter-param'
import { UrlBuilder } from './url-builder'
import { HttpError } from './http-error'
import { YearQuarterParam } from '../../fiscal-periods/year-quarter-param'
import { UrlBuilder } from '../url-builder'
import { HttpError } from '../http-error'

export class BuffettCodeApiClientV2 {
static readonly baseUrl = 'https://api.buffett-code.com/api/v2'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IndicatorProperty } from './indicator-property'
import { useMockedUrlFetchApp } from './test-helper'
import { useMockedUrlFetchApp } from '../test-helper'

import { default as indicator } from '../__mocks__/fixtures/indicator-property'
import { default as indicator } from '../../__mocks__/fixtures/v2/indicator-property'

test('isIndicatorProperty', () => {
useMockedUrlFetchApp(200, JSON.stringify(indicator))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { QuarterProperty } from './quarter-property'
import { useMockedUrlFetchApp } from './test-helper'
import { useMockedUrlFetchApp } from '../test-helper'

import { default as quarter } from '../__mocks__/fixtures/quarter-property'
import { default as quarter } from '../../__mocks__/fixtures/v2/quarter-property'

test('isQuarterProperty', () => {
useMockedUrlFetchApp(200, JSON.stringify(quarter))
Expand Down
10 changes: 6 additions & 4 deletions src/custom-functions/bcode-indicator.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { bcodeIndicator } from './bcode-indicator'
import { CachingBuffettCodeApiClientV2 } from '../api/caching-client'
import { CachingBuffettCodeApiClientV2 } from '../api/v2/caching-client'
import { IndicatorCache } from '../services/indicator-cache'
import { IndicatorPropertyCache } from '../services/indicator-property-cache'
import { BcodeResult } from './bcode-result'

jest.mock('../api/client', () => jest.requireActual('../__mocks__/api/client'))
jest.mock('../api/indicator-property', () =>
jest.requireActual('../__mocks__/api/indicator-property')
jest.mock('../api/v2/client', () =>
jest.requireActual('../__mocks__/api/v2/client')
)
jest.mock('../api/v2/indicator-property', () =>
jest.requireActual('../__mocks__/api/v2/indicator-property')
)
jest.mock('../services/indicator-cache', () =>
jest.requireActual('../__mocks__/services/indicator-cache')
Expand Down
4 changes: 2 additions & 2 deletions src/custom-functions/bcode-indicator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApiResponseError } from './error'
import { CachingBuffettCodeApiClientV2 } from '../api/caching-client'
import { CachingIndicatorProperty } from '../api/caching-indicator-property'
import { CachingBuffettCodeApiClientV2 } from '../api/v2/caching-client'
import { CachingIndicatorProperty } from '../api/v2/caching-indicator-property'
import { BcodeResult } from './bcode-result'

export function bcodeIndicator(
Expand Down
8 changes: 4 additions & 4 deletions src/custom-functions/bcode-label.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { bcodeLabel } from './bcode-label'
import { IndicatorPropertyCache } from '../services/indicator-property-cache'
import { QuarterPropertyCache } from '../services/quarter-property-cache'

jest.mock('../api/indicator-property', () =>
jest.requireActual('../__mocks__/api/indicator-property')
jest.mock('../api/v2/indicator-property', () =>
jest.requireActual('../__mocks__/api/v2/indicator-property')
)
jest.mock('../api/quarter-property', () =>
jest.requireActual('../__mocks__/api/quarter-property')
jest.mock('../api/v2/quarter-property', () =>
jest.requireActual('../__mocks__/api/v2/quarter-property')
)
jest.mock('../services/indicator-property-cache', () =>
jest.requireActual('../__mocks__/services/indicator-property-cache')
Expand Down
4 changes: 2 additions & 2 deletions src/custom-functions/bcode-label.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CachingIndicatorProperty } from '../api/caching-indicator-property'
import { CachingQuarterProperty } from '../api/caching-quarter-property'
import { CachingIndicatorProperty } from '../api/v2/caching-indicator-property'
import { CachingQuarterProperty } from '../api/v2/caching-quarter-property'

export function bcodeLabel(propertyName: string): string {
if (!propertyName) {
Expand Down
10 changes: 6 additions & 4 deletions src/custom-functions/bcode-quarter.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { bcodeQuarter } from './bcode-quarter'
import { CachingBuffettCodeApiClientV2 } from '../api/caching-client'
import { CachingBuffettCodeApiClientV2 } from '../api/v2/caching-client'
import { QuarterCache } from '../__mocks__/services/quarter-cache'
import { QuarterPropertyCache } from '../services/quarter-property-cache'
import { BcodeResult } from './bcode-result'
import { YearQuarter } from '../fiscal-periods/year-quarter'

jest.mock('../api/client', () => jest.requireActual('../__mocks__/api/client'))
jest.mock('../api/quarter-property', () =>
jest.requireActual('../__mocks__/api/quarter-property')
jest.mock('../api/v2/client', () =>
jest.requireActual('../__mocks__/api/v2/client')
)
jest.mock('../api/v2/quarter-property', () =>
jest.requireActual('../__mocks__/api/v2/quarter-property')
)
jest.mock('../services/company-cache', () =>
jest.requireActual('../__mocks__/services/company-cache')
Expand Down
4 changes: 2 additions & 2 deletions src/custom-functions/bcode-quarter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {
OndemandApiNotEnabledError,
UnsupportedTickerError
} from './error'
import { CachingBuffettCodeApiClientV2 } from '../api/caching-client'
import { CachingQuarterProperty } from '../api/caching-quarter-property'
import { CachingBuffettCodeApiClientV2 } from '../api/v2/caching-client'
import { CachingQuarterProperty } from '../api/v2/caching-quarter-property'
import { CompanyService } from '../api/company-service'
import { BcodeResult } from './bcode-result'
import { YearQuarterParam } from '../fiscal-periods/year-quarter-param'
Expand Down
8 changes: 4 additions & 4 deletions src/custom-functions/bcode-unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { bcodeUnit } from './bcode-unit'
import { IndicatorPropertyCache } from '../services/indicator-property-cache'
import { QuarterPropertyCache } from '../services/quarter-property-cache'

jest.mock('../api/indicator-property', () =>
jest.requireActual('../__mocks__/api/indicator-property')
jest.mock('../api/v2/indicator-property', () =>
jest.requireActual('../__mocks__/api/v2/indicator-property')
)
jest.mock('../api/quarter-property', () =>
jest.requireActual('../__mocks__/api/quarter-property')
jest.mock('../api/v2/quarter-property', () =>
jest.requireActual('../__mocks__/api/v2/quarter-property')
)
jest.mock('../services/indicator-property-cache', () =>
jest.requireActual('../__mocks__/services/indicator-property-cache')
Expand Down
4 changes: 2 additions & 2 deletions src/custom-functions/bcode-unit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CachingIndicatorProperty } from '../api/caching-indicator-property'
import { CachingQuarterProperty } from '../api/caching-quarter-property'
import { CachingIndicatorProperty } from '../api/v2/caching-indicator-property'
import { CachingQuarterProperty } from '../api/v2/caching-quarter-property'

export function bcodeUnit(propertyName: string): string {
if (!propertyName) {
Expand Down
2 changes: 1 addition & 1 deletion src/services/company-cache.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CompanyCache } from './company-cache'
import * as companyFixture from '../__mocks__/fixtures/company'
import * as companyFixture from '../__mocks__/fixtures/v2/company'
import { getMock, putMock } from './cache-test-helper'

const companies = companyFixture.default
Expand Down
12 changes: 7 additions & 5 deletions src/services/csv-exporter.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { CsvExporter } from './csv-exporter'
import { QuarterCache } from './quarter-cache'
import { QuarterProperty } from '../api/quarter-property'
import { QuarterProperty } from '../api/v2/quarter-property'
import { YearQuarter } from '../fiscal-periods/year-quarter'

import { default as quarter } from '../__mocks__/fixtures/quarter-property'
import { default as quarter } from '../__mocks__/fixtures/v2/quarter-property'

jest.mock('../setting')
jest.mock('../api/client', () => jest.requireActual('../__mocks__/api/client'))
jest.mock('../api/quarter-property', () =>
jest.requireActual('../__mocks__/api/quarter-property')
jest.mock('../api/v2/client', () =>
jest.requireActual('../__mocks__/api/v2/client')
)
jest.mock('../api/v2/quarter-property', () =>
jest.requireActual('../__mocks__/api/v2/quarter-property')
)
jest.mock('../services/quarter-property-cache', () =>
jest.requireActual('../__mocks__/services/quarter-property-cache')
Expand Down
4 changes: 2 additions & 2 deletions src/services/csv-exporter.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { CachingBuffettCodeApiClientV2 } from '../api/caching-client'
import { CachingBuffettCodeApiClientV2 } from '../api/v2/caching-client'
import { Setting } from '../setting'
import { YearQuarter } from '../fiscal-periods/year-quarter'
import { YearQuarterRange } from '../fiscal-periods/year-quarter-range'
import { YearQuarterParam } from '../fiscal-periods/year-quarter-param'
import { CachingQuarterProperty } from '../api/caching-quarter-property'
import { CachingQuarterProperty } from '../api/v2/caching-quarter-property'
import { OndemandApiPeriodRange } from '../api/ondemand-api-period-range'
import { CompanyService } from '../api/company-service'

Expand Down
2 changes: 1 addition & 1 deletion src/services/indicator-cache.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IndicatorCache } from './indicator-cache'
import * as indicatorFixture from '../__mocks__/fixtures/indicator'
import * as indicatorFixture from '../__mocks__/fixtures/v2/indicator'
import { getMock, putMock } from './cache-test-helper'

test('key', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/services/indicator-property-cache.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IndicatorPropertyCache } from './indicator-property-cache'
import * as indicatorProperty from '../__mocks__/fixtures/indicator-property'
import * as indicatorProperty from '../__mocks__/fixtures/v2/indicator-property'
import { getMock, putMock } from './cache-test-helper'

test('get', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/services/quarter-cache.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { QuarterCache } from './quarter-cache'
import { YearQuarter } from '../fiscal-periods/year-quarter'
import * as quarterFixture from '../__mocks__/fixtures/quarter'
import * as quarterFixture from '../__mocks__/fixtures/v2/quarter'
import { getMock, putMock } from './cache-test-helper'

test('key', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/services/quarter-property-cache.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { QuarterPropertyCache } from './quarter-property-cache'
import * as quarterProperty from '../__mocks__/fixtures/quarter-property'
import * as quarterProperty from '../__mocks__/fixtures/v2/quarter-property'
import { getMock, putMock } from './cache-test-helper'

test('get', () => {
Expand Down