From 1ad034c440b5fddd5e06b85c5919c38bb3298b08 Mon Sep 17 00:00:00 2001 From: storywithoutend Date: Wed, 20 Sep 2023 12:09:56 +0800 Subject: [PATCH] update tests --- .../[name]/tabs/MoreTab/MoreTab.test.tsx | 59 ------------------- .../RolesSection/components/RoleRow.test.tsx | 4 +- .../input/SendName/SendName.test.tsx | 5 +- 3 files changed, 4 insertions(+), 64 deletions(-) diff --git a/src/components/pages/profile/[name]/tabs/MoreTab/MoreTab.test.tsx b/src/components/pages/profile/[name]/tabs/MoreTab/MoreTab.test.tsx index ccff48d8d..a246f4e17 100644 --- a/src/components/pages/profile/[name]/tabs/MoreTab/MoreTab.test.tsx +++ b/src/components/pages/profile/[name]/tabs/MoreTab/MoreTab.test.tsx @@ -67,63 +67,4 @@ describe('MoreTab', () => { expect(screen.queryByText('Token')).not.toBeInTheDocument() }) }) - describe('Miscellaneous', () => { - it('should pass expiry for .eth name', () => { - const date = new Date() - renderHelper({ name: 'test.eth', isWrapped: false, expiryDate: date }) - expect(screen.getByText(`Miscellaneous-expiry:${date.toString()}`)).toBeVisible() - }) - it('should pass expiry for PCC wrapped name', () => { - const date = new Date() - renderHelper({ - name: 'sub.test.eth', - isWrapped: true, - pccExpired: false, - wrapperData: { parent: { PARENT_CANNOT_CONTROL: true }, expiryDate: date } as any, - }) - expect(screen.getByText(`Miscellaneous-expiry:${date.toString()}`)).toBeVisible() - }) - it('should pass expiry for PCC expired wrapped name', () => { - const date = new Date(Date.now() - 1000) - renderHelper({ - name: 'sub.test.eth', - isWrapped: false, - pccExpired: true, - wrapperData: { expiryDate: date, parent: { PARENT_CANNOT_CONTROL: false } } as any, - }) - expect(screen.getByText(`Miscellaneous-expiry:${date.toString()}`)).toBeVisible() - }) - it('should not pass expiry for non PCC wrapped name', () => { - const date = new Date() - renderHelper({ - name: 'sub.test.eth', - isWrapped: true, - pccExpired: false, - wrapperData: { expiryDate: date, parent: { PARENT_CANNOT_CONTROL: false } } as any, - }) - expect(screen.queryByText(`Miscellaneous-expiry:${date.toString()}`)).not.toBeInTheDocument() - }) - it('should not pass expiry for non PCC expired wrapped name', () => { - const date = new Date(Date.now() - 1000) - renderHelper({ - name: 'sub.test.eth', - isWrapped: true, - pccExpired: false, - wrapperData: { expiryDate: date, parent: { PARENT_CANNOT_CONTROL: false } } as any, - }) - expect(screen.queryByText(`Miscellaneous-expiry:${date.toString()}`)).not.toBeInTheDocument() - }) - it('should use registrar expiry if available', () => { - const registrarExpiry = new Date(Date.now() + 1000) - const wrapperExpiry = new Date(Date.now() + 2000) - renderHelper({ - name: 'test.eth', - isWrapped: true, - pccExpired: false, - wrapperData: { expiryDate: wrapperExpiry } as any, - expiryDate: registrarExpiry, - }) - expect(screen.getByText(`Miscellaneous-expiry:${registrarExpiry.toString()}`)).toBeVisible() - }) - }) }) diff --git a/src/components/pages/profile/[name]/tabs/OwnershipTab/sections/RolesSection/components/RoleRow.test.tsx b/src/components/pages/profile/[name]/tabs/OwnershipTab/sections/RolesSection/components/RoleRow.test.tsx index 473e37dad..203fa8c0f 100644 --- a/src/components/pages/profile/[name]/tabs/OwnershipTab/sections/RolesSection/components/RoleRow.test.tsx +++ b/src/components/pages/profile/[name]/tabs/OwnershipTab/sections/RolesSection/components/RoleRow.test.tsx @@ -87,7 +87,7 @@ describe('RoleRow', () => { await waitFor(() => { expect(screen.getByText('address.viewAddress')).toBeVisible() }) - expect(screen.queryByText('transaction.viewOnEtherscan')).toBeVisible() + expect(screen.queryByText('transaction.viewEtherscan')).toBeVisible() }) it('should display view on etherscan if usePrimary returns subaname and name is wrapped', async () => { @@ -97,7 +97,7 @@ describe('RoleRow', () => { await waitFor(() => { expect(screen.getByText('address.viewAddress')).toBeVisible() }) - expect(screen.queryByText('transaction.viewOnEtherscan')).toBeVisible() + expect(screen.queryByText('transaction.viewEtherscan')).toBeVisible() }) it('should display edit roles option if action type `edit-roles`', async () => { diff --git a/src/transaction-flow/input/SendName/SendName.test.tsx b/src/transaction-flow/input/SendName/SendName.test.tsx index fb002f7e4..0145204c0 100644 --- a/src/transaction-flow/input/SendName/SendName.test.tsx +++ b/src/transaction-flow/input/SendName/SendName.test.tsx @@ -91,11 +91,10 @@ afterEach(() => { }) describe('SendName', () => { - it('should', async () => { + it('should render', async () => { render( {}}/>) - await userEvent.type(screen.getByTestId('send-name-search-input'), 'owner') + await userEvent.type(screen.getByTestId('send-name-search-input'), 'nick') await userEvent.click(screen.getByTestId('search-result-0xnick')) - }) it('should disable the row if it is the current send role ', async () => {