-
Notifications
You must be signed in to change notification settings - Fork 505
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ab2f498
commit 6e118f2
Showing
4 changed files
with
52 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/[email protected]/**', (route) => route.abort()); | ||
|
||
const component = await mount( | ||
<TestApp> | ||
<ContractCode addressHash={ addressHash } noSocket/> | ||
</TestApp>, | ||
{ 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/[email protected]/**', (route) => route.abort()); | ||
|
||
const component = await mount( | ||
<TestApp> | ||
<ContractCode addressHash={ addressHash } noSocket/> | ||
</TestApp>, | ||
{ 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/[email protected]/**', (route) => route.abort()); | ||
|
||
const component = await mount( | ||
<TestApp> | ||
<ContractCode addressHash={ addressHash } noSocket/> | ||
</TestApp>, | ||
{ 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/[email protected]/**', (route) => route.abort()); | ||
|
||
const component = await mount( | ||
<TestApp> | ||
<ContractCode addressHash={ addressHash } noSocket/> | ||
</TestApp>, | ||
{ hooksConfig }, | ||
); | ||
|
||
await expect(component).toHaveScreenshot(); | ||
await expect(component).toHaveScreenshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters