diff --git a/apps/web/src/components/Basenames/AcceptOwnershipBanner/index.test.tsx b/apps/web/src/components/Basenames/AcceptOwnershipBanner/index.test.tsx new file mode 100644 index 0000000000..37bdbbaa46 --- /dev/null +++ b/apps/web/src/components/Basenames/AcceptOwnershipBanner/index.test.tsx @@ -0,0 +1,208 @@ +/** + * @jest-environment jsdom + */ +import { render, screen, fireEvent, waitFor } from '@testing-library/react'; +import AcceptOwnershipBanner from './index'; +import { WriteTransactionWithReceiptStatus } from 'apps/web/src/hooks/useAcceptOwnership'; + +// Mock the hooks +const mockUsePendingOwnerStatus = jest.fn(); +const mockUseAcceptOwnership = jest.fn(); + +jest.mock('apps/web/src/hooks/usePendingOwnerStatus', () => ({ + usePendingOwnerStatus: () => mockUsePendingOwnerStatus(), +})); + +jest.mock('apps/web/src/hooks/useAcceptOwnership', () => ({ + useAcceptOwnership: () => mockUseAcceptOwnership(), + WriteTransactionWithReceiptStatus: { + Idle: 'idle', + Initiated: 'initiated', + Canceled: 'canceled', + Approved: 'approved', + Processing: 'processing', + Reverted: 'reverted', + Success: 'success', + }, +})); + +// Mock WalletIdentity component +jest.mock('apps/web/src/components/WalletIdentity', () => { + return function MockWalletIdentity({ address }: { address: string }) { + return
+ You have been designated as the pending owner of the UpgradeableRegistrarController. + Accept ownership to complete the transfer. +
Error accepting ownership
{transactionError.message}