mirror of
https://github.com/gethomepage/homepage.git
synced 2026-09-17 17:45:48 -07:00
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
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:
@@ -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>
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user