Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
storywithoutend committed Sep 20, 2023
1 parent 39ee99d commit 1ad034c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 64 deletions.
59 changes: 0 additions & 59 deletions src/components/pages/profile/[name]/tabs/MoreTab/MoreTab.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -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 () => {
Expand Down
5 changes: 2 additions & 3 deletions src/transaction-flow/input/SendName/SendName.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,10 @@ afterEach(() => {
})

describe('SendName', () => {
it('should', async () => {
it('should render', async () => {
render(<SendName data={{name: 'test.eth'}} dispatch={mockDispatch} onDismiss={() => {}}/>)
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 () => {
Expand Down

0 comments on commit 1ad034c

Please sign in to comment.