From 6e118f27082cc8f1f8fec7a247129b8db48b55c6 Mon Sep 17 00:00:00 2001 From: isstuev Date: Mon, 19 Feb 2024 11:35:22 +0100 Subject: [PATCH] review fixes --- ui/address/contract/ContractCode.pw.tsx | 93 ++++++++++--------- .../contract/ContractSecurityAudits.tsx | 10 +- .../fields/AuditSubmitterEmail.tsx | 1 - .../fields/AuditSubmitterName.tsx | 1 - 4 files changed, 52 insertions(+), 53 deletions(-) diff --git a/ui/address/contract/ContractCode.pw.tsx b/ui/address/contract/ContractCode.pw.tsx index 8a96a2c21c..cbd660a941 100644 --- a/ui/address/contract/ContractCode.pw.tsx +++ b/ui/address/contract/ContractCode.pw.tsx @@ -234,50 +234,53 @@ test('non verified', async({ mount, page }) => { await expect(component).toHaveScreenshot(); }); -const withAuditsTest = test.extend({ - // eslint-disable-next-line @typescript-eslint/no-explicit-any - context: contextWithEnvs(configs.UIEnvs.hasContractAuditReports) as any, -}); - -withAuditsTest('with audits feature, no audits', async({ mount, page }) => { - await page.route(CONTRACT_API_URL, (route) => route.fulfill({ - status: 200, - body: JSON.stringify(contractMock.verified), - })); - await page.route(CONTRACT_AUDITS_API_URL, (route) => route.fulfill({ - status: 200, - body: JSON.stringify({ items: [] }), - })); - await page.route('https://cdn.jsdelivr.net/npm/monaco-editor@0.33.0/**', (route) => route.abort()); - - const component = await mount( - - - , - { hooksConfig }, - ); - - await expect(component).toHaveScreenshot(); -}); - -withAuditsTest('with audits feature, has audits', async({ mount, page }) => { - await page.route(CONTRACT_API_URL, (route) => route.fulfill({ - status: 200, - body: JSON.stringify(contractMock.verified), - })); - await page.route(CONTRACT_AUDITS_API_URL, (route) => route.fulfill({ - status: 200, - body: JSON.stringify(contractAudits), - })); - - await page.route('https://cdn.jsdelivr.net/npm/monaco-editor@0.33.0/**', (route) => route.abort()); - - const component = await mount( - - - , - { hooksConfig }, - ); +test.describe('with audits feature', () => { + + const withAuditsTest = test.extend({ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + context: contextWithEnvs(configs.UIEnvs.hasContractAuditReports) as any, + }); + + withAuditsTest('no audits', async({ mount, page }) => { + await page.route(CONTRACT_API_URL, (route) => route.fulfill({ + status: 200, + body: JSON.stringify(contractMock.verified), + })); + await page.route(CONTRACT_AUDITS_API_URL, (route) => route.fulfill({ + status: 200, + body: JSON.stringify({ items: [] }), + })); + await page.route('https://cdn.jsdelivr.net/npm/monaco-editor@0.33.0/**', (route) => route.abort()); + + const component = await mount( + + + , + { hooksConfig }, + ); + + await expect(component).toHaveScreenshot(); + }); + + withAuditsTest('has audits', async({ mount, page }) => { + await page.route(CONTRACT_API_URL, (route) => route.fulfill({ + status: 200, + body: JSON.stringify(contractMock.verified), + })); + await page.route(CONTRACT_AUDITS_API_URL, (route) => route.fulfill({ + status: 200, + body: JSON.stringify(contractAudits), + })); + + await page.route('https://cdn.jsdelivr.net/npm/monaco-editor@0.33.0/**', (route) => route.abort()); + + const component = await mount( + + + , + { hooksConfig }, + ); - await expect(component).toHaveScreenshot(); + await expect(component).toHaveScreenshot(); + }); }); diff --git a/ui/address/contract/ContractSecurityAudits.tsx b/ui/address/contract/ContractSecurityAudits.tsx index 1cff14bffb..cac7c356b0 100644 --- a/ui/address/contract/ContractSecurityAudits.tsx +++ b/ui/address/contract/ContractSecurityAudits.tsx @@ -1,4 +1,4 @@ -import { Box, Button, Skeleton, useDisclosure } from '@chakra-ui/react'; +import { Box, Button, useDisclosure } from '@chakra-ui/react'; import React from 'react'; import type { SmartContractSecurityAuditSubmission } from 'types/api/contract'; @@ -61,11 +61,9 @@ const ContractSecurityAudits = ({ addressHash }: Props) => { mt={ 2 } > { data.items.map(item => ( - - - { `${ item.audit_company_name }, ${ dayjs(item.audit_publish_date).format('MMM DD, YYYY') }` } - - + + { `${ item.audit_company_name }, ${ dayjs(item.audit_publish_date).format('MMM DD, YYYY') }` } + )) } diff --git a/ui/address/contract/contractSubmitAuditForm/fields/AuditSubmitterEmail.tsx b/ui/address/contract/contractSubmitAuditForm/fields/AuditSubmitterEmail.tsx index c07bf37f63..4e72e01ab1 100644 --- a/ui/address/contract/contractSubmitAuditForm/fields/AuditSubmitterEmail.tsx +++ b/ui/address/contract/contractSubmitAuditForm/fields/AuditSubmitterEmail.tsx @@ -20,7 +20,6 @@ const AuditSubmitterEmail = ({ control }: Props) => { { ...field } required isInvalid={ Boolean(fieldState.error) } - autoComplete="off" /> diff --git a/ui/address/contract/contractSubmitAuditForm/fields/AuditSubmitterName.tsx b/ui/address/contract/contractSubmitAuditForm/fields/AuditSubmitterName.tsx index de5fbcf045..c5b9376c6d 100644 --- a/ui/address/contract/contractSubmitAuditForm/fields/AuditSubmitterName.tsx +++ b/ui/address/contract/contractSubmitAuditForm/fields/AuditSubmitterName.tsx @@ -19,7 +19,6 @@ const AuditSubmitterName = ({ control }: Props) => { { ...field } required isInvalid={ Boolean(fieldState.error) } - autoComplete="off" />