From c01fe74bcbab289ccf693ffe4887303a529bd584 Mon Sep 17 00:00:00 2001 From: Gadi Cohen Date: Thu, 12 Aug 2021 16:07:36 +0300 Subject: [PATCH] fix(quoteSummary): sellingGeneralAdministrative (fixes #258) IncomeStatementHistoryElement > sellingGeneralAdministrative Previously allowed type "number" only, but now accepts null too. As noted in symbol "CMCOM.AS" (test added) --- schema.json | 2 +- src/modules/quoteSummary-iface.ts | 2 +- src/modules/quoteSummary.spec.ts | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/schema.json b/schema.json index 506d989a..608bffe0 100644 --- a/schema.json +++ b/schema.json @@ -5138,7 +5138,7 @@ "yahooFinanceType": "number|null" }, "sellingGeneralAdministrative": { - "yahooFinanceType": "number" + "yahooFinanceType": "number|null" }, "nonRecurring": { "yahooFinanceType": "number|null" diff --git a/src/modules/quoteSummary-iface.ts b/src/modules/quoteSummary-iface.ts index 9c390ed9..fd9903e6 100644 --- a/src/modules/quoteSummary-iface.ts +++ b/src/modules/quoteSummary-iface.ts @@ -513,7 +513,7 @@ export interface IncomeStatementHistoryElement { costOfRevenue: number; grossProfit: number; researchDevelopment: number | null; - sellingGeneralAdministrative: number; + sellingGeneralAdministrative: number | null; nonRecurring: number | null; otherOperatingExpenses: number | null; totalOperatingExpenses: number; diff --git a/src/modules/quoteSummary.spec.ts b/src/modules/quoteSummary.spec.ts index 78d30ab5..49ca508f 100644 --- a/src/modules/quoteSummary.spec.ts +++ b/src/modules/quoteSummary.spec.ts @@ -1,9 +1,16 @@ import quoteSummary, { QuoteSummaryModules } from "./quoteSummary.js"; import { InvalidOptionsError } from "../lib/errors.js"; -import { testSymbols } from "../../tests/symbols.js"; +import { testSymbols as commonTestSymbols } from "../../tests/symbols.js"; import testYf from "../../tests/testYf.js"; +const testSymbols = [ + ...commonTestSymbols, + // incomeStatementHistory/sellingGeneralAdministrative is null (#258) + // "Got {}->null for 'number', did you want 'number | null' ?" + "CMCOM.AS", +]; + const yf = testYf({ quoteSummary }); interface itValidatesOpts {