070959e133
landing-page-staging / Deploy landing page to staging (push) Has been skipped
landing-page-ci / Validate landing page (push) Failing after 4s
visual-baseline / Capture visual baselines (push) Has been cancelled
bake-plugin-previews / Bake plugin previews (push) Has been cancelled
34 lines
848 B
TypeScript
34 lines
848 B
TypeScript
// @vitest-environment jsdom
|
|
|
|
import { cleanup, fireEvent, render, screen } from '@testing-library/react';
|
|
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
import { AmrBalanceDialog } from '../../src/components/AmrBalanceDialog';
|
|
|
|
afterEach(() => {
|
|
cleanup();
|
|
vi.restoreAllMocks();
|
|
});
|
|
|
|
describe('AmrBalanceDialog', () => {
|
|
it('dismisses from the corner close button', () => {
|
|
const onClose = vi.fn();
|
|
|
|
render(
|
|
<AmrBalanceDialog
|
|
reason="insufficient"
|
|
balanceUsd="0.00"
|
|
profile="prod"
|
|
entrySource="chat_balance_gate_upgrade"
|
|
metricsConsent={false}
|
|
installationId={null}
|
|
onClose={onClose}
|
|
onResolved={vi.fn()}
|
|
/>,
|
|
);
|
|
|
|
fireEvent.click(screen.getByRole('button', { name: 'Close' }));
|
|
|
|
expect(onClose).toHaveBeenCalledTimes(1);
|
|
});
|
|
});
|