Commit 6e118f27 authored by isstuev's avatar isstuev

review fixes

parent ab2f498c
...@@ -234,50 +234,53 @@ test('non verified', async({ mount, page }) => { ...@@ -234,50 +234,53 @@ test('non verified', async({ mount, page }) => {
await expect(component).toHaveScreenshot(); await expect(component).toHaveScreenshot();
}); });
const withAuditsTest = test.extend({ test.describe('with audits feature', () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
context: contextWithEnvs(configs.UIEnvs.hasContractAuditReports) as any, 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, withAuditsTest('no audits', async({ mount, page }) => {
body: JSON.stringify(contractMock.verified), await page.route(CONTRACT_API_URL, (route) => route.fulfill({
})); status: 200,
await page.route(CONTRACT_AUDITS_API_URL, (route) => route.fulfill({ body: JSON.stringify(contractMock.verified),
status: 200, }));
body: JSON.stringify({ items: [] }), await page.route(CONTRACT_AUDITS_API_URL, (route) => route.fulfill({
})); status: 200,
await page.route('https://cdn.jsdelivr.net/npm/monaco-editor@0.33.0/**', (route) => route.abort()); body: JSON.stringify({ items: [] }),
}));
const component = await mount( await page.route('https://cdn.jsdelivr.net/npm/monaco-editor@0.33.0/**', (route) => route.abort());
<TestApp>
<ContractCode addressHash={ addressHash } noSocket/> const component = await mount(
</TestApp>, <TestApp>
{ hooksConfig }, <ContractCode addressHash={ addressHash } noSocket/>
); </TestApp>,
{ hooksConfig },
await expect(component).toHaveScreenshot(); );
});
await expect(component).toHaveScreenshot();
withAuditsTest('with audits feature, has audits', async({ mount, page }) => { });
await page.route(CONTRACT_API_URL, (route) => route.fulfill({
status: 200, withAuditsTest('has audits', async({ mount, page }) => {
body: JSON.stringify(contractMock.verified), await page.route(CONTRACT_API_URL, (route) => route.fulfill({
})); status: 200,
await page.route(CONTRACT_AUDITS_API_URL, (route) => route.fulfill({ body: JSON.stringify(contractMock.verified),
status: 200, }));
body: JSON.stringify(contractAudits), 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( await page.route('https://cdn.jsdelivr.net/npm/monaco-editor@0.33.0/**', (route) => route.abort());
<TestApp>
<ContractCode addressHash={ addressHash } noSocket/> const component = await mount(
</TestApp>, <TestApp>
{ hooksConfig }, <ContractCode addressHash={ addressHash } noSocket/>
); </TestApp>,
{ hooksConfig },
);
await expect(component).toHaveScreenshot(); await expect(component).toHaveScreenshot();
});
}); });
import { Box, Button, Skeleton, useDisclosure } from '@chakra-ui/react'; import { Box, Button, useDisclosure } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import type { SmartContractSecurityAuditSubmission } from 'types/api/contract'; import type { SmartContractSecurityAuditSubmission } from 'types/api/contract';
...@@ -61,11 +61,9 @@ const ContractSecurityAudits = ({ addressHash }: Props) => { ...@@ -61,11 +61,9 @@ const ContractSecurityAudits = ({ addressHash }: Props) => {
mt={ 2 } mt={ 2 }
> >
{ data.items.map(item => ( { data.items.map(item => (
<Skeleton isLoaded={ !isPlaceholderData } key={ item.audit_company_name + item.audit_publish_date }> <LinkExternal href={ item.audit_report_url } key={ item.audit_company_name + item.audit_publish_date } isLoading={ isPlaceholderData }>
<LinkExternal href={ item.audit_report_url }> { `${ 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') }` } </LinkExternal>
</LinkExternal>
</Skeleton>
)) } )) }
</ContainerWithScrollY> </ContainerWithScrollY>
</Box> </Box>
......
...@@ -20,7 +20,6 @@ const AuditSubmitterEmail = ({ control }: Props) => { ...@@ -20,7 +20,6 @@ const AuditSubmitterEmail = ({ control }: Props) => {
{ ...field } { ...field }
required required
isInvalid={ Boolean(fieldState.error) } isInvalid={ Boolean(fieldState.error) }
autoComplete="off"
/> />
<InputPlaceholder text="Submitter email" error={ fieldState.error }/> <InputPlaceholder text="Submitter email" error={ fieldState.error }/>
</FormControl> </FormControl>
......
...@@ -19,7 +19,6 @@ const AuditSubmitterName = ({ control }: Props) => { ...@@ -19,7 +19,6 @@ const AuditSubmitterName = ({ control }: Props) => {
{ ...field } { ...field }
required required
isInvalid={ Boolean(fieldState.error) } isInvalid={ Boolean(fieldState.error) }
autoComplete="off"
/> />
<InputPlaceholder text="Submitter name" error={ fieldState.error }/> <InputPlaceholder text="Submitter name" error={ fieldState.error }/>
</FormControl> </FormControl>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment