diff --git a/components/pollen-balance/pollen-balance-display-view.tsx b/components/pollen-balance/pollen-balance-display-view.tsx index 09cd8f9..4fa1e74 100644 --- a/components/pollen-balance/pollen-balance-display-view.tsx +++ b/components/pollen-balance/pollen-balance-display-view.tsx @@ -56,8 +56,8 @@ export const PollenBalanceDisplayView = memo(function PollenBalanceDisplayView({ Error -
@@ -98,8 +98,8 @@ export const PollenBalanceDisplayView = memo(function PollenBalanceDisplayView({ {formattedBalance} -
@@ -118,7 +118,7 @@ export const PollenBalanceDisplayView = memo(function PollenBalanceDisplayView({

{isLowBalance - ? "Your balance is running low. Consider topping up." + ? "Your balance is running low." : "Your current Pollinations account balance."}

diff --git a/hooks/use-pollen-balance.test.tsx b/hooks/use-pollen-balance.test.tsx index 7963aec..9ba6dbe 100644 --- a/hooks/use-pollen-balance.test.tsx +++ b/hooks/use-pollen-balance.test.tsx @@ -55,12 +55,12 @@ describe("hooks/use-pollen-balance", () => { (balance) => { const result = formatBalance(balance); expect(result).not.toBeNull(); - + // Verify format: should have exactly 2 decimal places const parts = result!.split("."); expect(parts.length).toBe(2); expect(parts[1].length).toBe(2); - + // Verify the numeric value is preserved (within floating point tolerance) const parsed = parseFloat(result!); expect(Math.abs(parsed - balance)).toBeLessThan(0.01); @@ -206,7 +206,7 @@ describe("usePollenBalance hook", () => { // Make fetch hang to test loading state mockFetchPollenBalance.mockImplementation( - () => new Promise(() => {}) // Never resolves + () => new Promise(() => { }) // Never resolves ); const { result } = renderHook(() => usePollenBalance(), { @@ -253,7 +253,7 @@ describe("usePollenBalance hook", () => { isLoading: false, }); - mockFetchPollenBalance.mockResolvedValue({ balance: 0.5 }); // Below default threshold of 1 + mockFetchPollenBalance.mockResolvedValue({ balance: 0.49 }); // Below default threshold of 1 const { result } = renderHook(() => usePollenBalance(), { wrapper: createWrapper(), diff --git a/hooks/use-pollen-balance.ts b/hooks/use-pollen-balance.ts index b6a1065..66c37d6 100644 --- a/hooks/use-pollen-balance.ts +++ b/hooks/use-pollen-balance.ts @@ -34,10 +34,10 @@ import { queryKeys, STALE_TIMES, GC_TIMES } from "@/lib/query"; /** * Default threshold for low balance warning (in pollen units) - * Set to 1 because we can't infer max balance from the API - users can top up - * via Polar.sh at any time. 1 pollen means they're genuinely running low. + * Set to 0.5 because we can't infer max balance from the API - users can top up + * via Polar.sh at any time. 0.5 pollen means they're genuinely running low. */ -export const DEFAULT_LOW_BALANCE_THRESHOLD = 1; +export const DEFAULT_LOW_BALANCE_THRESHOLD = 0.5; /** * Minimum interval between balance refreshes (in milliseconds)