The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(billing): pin the interval and crypto paths the panel exists to fix
M3gA-Mind11e2052a2a61
diff --git a/app/src/components/settings/panels/BillingPanel.test.tsx b/app/src/components/settings/panels/BillingPanel.test.tsxindex eef3f411cc..9f8bfbc265 100644--- a/app/src/components/settings/panels/BillingPanel.test.tsx+++ b/app/src/components/settings/panels/BillingPanel.test.tsx@@ -99,6 +99,50 @@ describe('<BillingPanel />', () => {);});+ // The reason this PR exists: the interval toggle must reach `purchasePlan`.+ // The monthly case above passes on the DEFAULT interval, so it stays green+ // even if `buildPlanId(tier, billingInterval)` is hardcoded back to+ // 'monthly' — i.e. even with the bug in #5865 fully restored. This is the+ // case that fails when that happens.+ it('upgrade after selecting Annual sends the yearly plan id', async () => {+ render(<BillingPanel />);+ await waitFor(() => expect(getCurrentPlanMock).toHaveBeenCalledTimes(1));++ fireEvent.click(screen.getByRole('button', { name: 'Annual' }));++ const upgradeButtons = await screen.findAllByRole('button', { name: 'Upgrade' });+ fireEvent.click(upgradeButtons[0]);++ await waitFor(() => expect(purchasePlanMock).toHaveBeenCalledTimes(1));+ expect(purchasePlanMock).toHaveBeenCalledWith('BASIC_YEARLY');+ });++ // The crypto branch of `handleUpgrade` had no test at all: the mock was+ // declared and stubbed but never asserted on, so the whole branch was+ // unexecuted. Also pins the interval coupling from the Codex P1 — selecting+ // crypto forces `annual`, so the price on screen matches the charge.+ it('upgrade with crypto creates a Coinbase charge and opens the hosted URL', async () => {+ render(<BillingPanel />);+ await waitFor(() => expect(getCurrentPlanMock).toHaveBeenCalledTimes(1));++ fireEvent.click(screen.getByRole('switch'));++ const upgradeButtons = await screen.findAllByRole('button', { name: 'Upgrade' });+ fireEvent.click(upgradeButtons[0]);++ await waitFor(() => expect(createCoinbaseChargeMock).toHaveBeenCalledTimes(1));+ expect(createCoinbaseChargeMock).toHaveBeenCalledWith('BASIC');+ // Crypto must never go through the Stripe path.+ expect(purchasePlanMock).not.toHaveBeenCalled();+ await waitFor(() =>+ expect(openUrlMock).toHaveBeenCalledWith('https://commerce.coinbase.com/test')+ );+ // Selecting crypto switches the interval to annual, so the monthly+ // button is disabled and the displayed price cannot disagree with the+ // charge that was created.+ expect(screen.getByRole('button', { name: 'Monthly' })).toBeDisabled();+ });+it('opens the billing dashboard when the user clicks the secondary button', async () => {render(<BillingPanel />);