Fixhancement: use ghostfolio baseCurrency for net worth (#7116)
Docker CI / Docker Build & Push (push) Has been cancelled
Lint / Linting Checks (push) Has been cancelled
Release Drafter / Update Release Draft (push) Has been cancelled
Release Drafter / Auto Label PR (push) Has been cancelled
Tests / vitest (1) (push) Has been cancelled
Tests / vitest (2) (push) Has been cancelled
Tests / vitest (3) (push) Has been cancelled
Tests / vitest (4) (push) Has been cancelled

This commit is contained in:
shamoon
2026-09-08 09:25:58 -07:00
committed by GitHub
parent 6ab83b0b5f
commit 2cd77eae1f
2 changed files with 35 additions and 3 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ export default function Component({ service }) {
{includeNetWorth && (
<Block
label="ghostfolio.net_worth"
value={`${performanceToday.performance.currentNetWorth.toFixed(2)} ${userInfo?.settings?.currency ?? ""}`}
value={`${performanceToday.performance.currentNetWorth.toFixed(2)} ${userInfo?.settings?.baseCurrency ?? userInfo?.settings?.currency ?? ""}`}
/>
)}
</Container>
+34 -2
View File
@@ -64,7 +64,7 @@ describe("widgets/ghostfolio/component", () => {
data: { performance: { currentGrossPerformancePercent: 0 } },
error: undefined,
})
.mockReturnValueOnce({ data: { settings: { currency: "USD" } }, error: undefined });
.mockReturnValueOnce({ data: { settings: { baseCurrency: "EUR", currency: "USD" } }, error: undefined });
const { container } = renderWithProviders(
<Component
@@ -82,6 +82,38 @@ describe("widgets/ghostfolio/component", () => {
expectBlockValue(container, "ghostfolio.gross_percent_today", "+10");
expectBlockValue(container, "ghostfolio.gross_percent_1y", "-5");
expectBlockValue(container, "ghostfolio.gross_percent_max", "0");
expectBlockValue(container, "ghostfolio.net_worth", "123.46 USD");
expectBlockValue(container, "ghostfolio.net_worth", "123.46 EUR");
});
it("uses the currency as fallback for net worth", () => {
useWidgetAPI
.mockReturnValueOnce({
data: { performance: { netPerformancePercentageWithCurrencyEffect: 0.1, currentNetWorth: 123.456 } },
error: undefined,
})
.mockReturnValueOnce({
data: { performance: { grossPerformancePercentage: -0.05 } },
error: undefined,
})
.mockReturnValueOnce({
data: { performance: { currentGrossPerformancePercent: 0 } },
error: undefined,
})
.mockReturnValueOnce({ data: { settings: { currency: "EUR" } }, error: undefined });
const { container } = renderWithProviders(
<Component
service={{
widget: {
type: "ghostfolio",
url: "http://x",
fields: ["gross_percent_today", "gross_percent_1y", "gross_percent_max", "net_worth"],
},
}}
/>,
{ settings: { hideErrors: false } },
);
expectBlockValue(container, "ghostfolio.net_worth", "123.46 EUR");
});
});