From 913ae0eb6d2ac616af219e20ad1da67ff31c3c0f Mon Sep 17 00:00:00 2001
From: Pedro Figueiredo
Date: Fri, 6 Sep 2024 13:41:21 +0100
Subject: [PATCH] clean up
---
test/e2e/helpers.js | 2 -
.../increase-token-allowance-redesign.spec.ts | 82 ++++++++-----------
.../edit-spending-cap-modal.test.tsx | 4 -
.../__snapshots__/spending-cap.test.tsx.snap | 2 +-
.../spending-cap/spending-cap.test.tsx | 2 -
.../approve/spending-cap/spending-cap.tsx | 2 -
6 files changed, 33 insertions(+), 61 deletions(-)
diff --git a/test/e2e/helpers.js b/test/e2e/helpers.js
index 683cf0bddf31..afef379fb361 100644
--- a/test/e2e/helpers.js
+++ b/test/e2e/helpers.js
@@ -1077,8 +1077,6 @@ async function getEventPayloads(driver, mockedEndpoints, hasRequest = true) {
mockedRequests.push(...(await mockedEndpoint.getSeenRequests()));
}
- console.log(JSON.stringify(mockedRequests));
-
return (
await Promise.all(
mockedRequests.map(async (req) => {
diff --git a/test/e2e/tests/confirmations/transactions/increase-token-allowance-redesign.spec.ts b/test/e2e/tests/confirmations/transactions/increase-token-allowance-redesign.spec.ts
index d8e7999efe23..1eaeb89ba37d 100644
--- a/test/e2e/tests/confirmations/transactions/increase-token-allowance-redesign.spec.ts
+++ b/test/e2e/tests/confirmations/transactions/increase-token-allowance-redesign.spec.ts
@@ -21,37 +21,6 @@ const { SMART_CONTRACTS } = require('../../../seeder/smart-contracts');
describe('Confirmation Redesign ERC20 Increase Allowance', function () {
const smartContract = SMART_CONTRACTS.HST;
- async function mocks(server: Mockttp) {
- return [await mocked4BytesIncreaseAllowance(server)];
- }
-
- async function mocked4BytesIncreaseAllowance(mockServer: Mockttp) {
- return await mockServer
- .forGet('https://www.4byte.directory/api/v1/signatures/')
- .always()
- .withQuery({ hex_signature: '0x39509351' })
- .thenCallback(() => {
- return {
- statusCode: 200,
- json: {
- count: 1,
- next: null,
- previous: null,
- results: [
- {
- id: 46002,
- created_at: '2018-06-24T21:43:27.354648Z',
- text_signature: 'increaseAllowance(address,uint256)',
- hex_signature: '0x39509351',
- bytes_signature: '9PQ',
- test: 'Priya',
- },
- ],
- },
- };
- });
- }
-
describe('Submit an increase allowance transaction @no-mmi', function () {
it('Sends a type 0 transaction (Legacy) with a small spending cap', async function () {
await withFixtures(
@@ -71,32 +40,17 @@ describe('Confirmation Redesign ERC20 Increase Allowance', function () {
testSpecificMock: mocks,
title: this.test?.fullTitle(),
},
- async ({
- driver,
- contractRegistry,
- mockedEndpoint: mockedEndpoints,
- }: TestSuiteArguments) => {
+ async ({ driver, contractRegistry }: TestSuiteArguments) => {
await openDAppWithContract(driver, contractRegistry, smartContract);
await createERC20IncreaseAllowanceTransaction(driver);
- const events = await getEventPayloads(
- driver,
- mockedEndpoints as MockedEndpoint[],
- false,
- );
-
- console.log('here '.repeat(42), { mockedEndpoints, events });
- await driver.delay(5000);
-
const NEW_SPENDING_CAP = '3';
await editSpendingCap(driver, NEW_SPENDING_CAP);
await scrollAndConfirmAndAssertConfirm(driver);
await assertChangedSpendingCap(driver, NEW_SPENDING_CAP);
-
- await driver.delay(5000);
},
);
});
@@ -200,6 +154,37 @@ describe('Confirmation Redesign ERC20 Increase Allowance', function () {
);
});
});
+
+ async function mocks(server: Mockttp) {
+ return [await mocked4BytesIncreaseAllowance(server)];
+ }
+
+ async function mocked4BytesIncreaseAllowance(mockServer: Mockttp) {
+ return await mockServer
+ .forGet('https://www.4byte.directory/api/v1/signatures/')
+ .always()
+ .withQuery({ hex_signature: '0x39509351' })
+ .thenCallback(() => {
+ return {
+ statusCode: 200,
+ json: {
+ count: 1,
+ next: null,
+ previous: null,
+ results: [
+ {
+ id: 46002,
+ created_at: '2018-06-24T21:43:27.354648Z',
+ text_signature: 'increaseAllowance(address,uint256)',
+ hex_signature: '0x39509351',
+ bytes_signature: '9PQ',
+ test: 'Priya',
+ },
+ ],
+ },
+ };
+ });
+ }
});
async function createERC20IncreaseAllowanceTransaction(driver: Driver) {
@@ -209,9 +194,6 @@ async function createERC20IncreaseAllowanceTransaction(driver: Driver) {
async function editSpendingCap(driver: Driver, newSpendingCap: string) {
await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog);
- await driver.takeScreenshot('spendingCapDialog-before-wait');
- await driver.delay(10000);
- await driver.takeScreenshot('spendingCapDialog-after-wait');
await driver.clickElement('[data-testid="edit-spending-cap-icon"');
await driver.fill(
diff --git a/ui/pages/confirmations/components/confirm/info/approve/edit-spending-cap-modal/edit-spending-cap-modal.test.tsx b/ui/pages/confirmations/components/confirm/info/approve/edit-spending-cap-modal/edit-spending-cap-modal.test.tsx
index 356bdfb74dc8..155cec0f5ea5 100644
--- a/ui/pages/confirmations/components/confirm/info/approve/edit-spending-cap-modal/edit-spending-cap-modal.test.tsx
+++ b/ui/pages/confirmations/components/confirm/info/approve/edit-spending-cap-modal/edit-spending-cap-modal.test.tsx
@@ -40,15 +40,11 @@ describe('', () => {
const isOpenEditSpendingCapModal = true;
const setIsOpenEditSpendingCapModal = () =>
console.log('setIsOpenEditSpendingCapModal');
- const customSpendingCap = '10';
- const setCustomSpendingCap = () => console.log('setCustomSpendingCap');
const { container } = renderWithConfirmContextProvider(
,
mockStore,
);
diff --git a/ui/pages/confirmations/components/confirm/info/approve/spending-cap/__snapshots__/spending-cap.test.tsx.snap b/ui/pages/confirmations/components/confirm/info/approve/spending-cap/__snapshots__/spending-cap.test.tsx.snap
index 3e9a6ad7cb8b..d249b4ba843b 100644
--- a/ui/pages/confirmations/components/confirm/info/approve/spending-cap/__snapshots__/spending-cap.test.tsx.snap
+++ b/ui/pages/confirmations/components/confirm/info/approve/spending-cap/__snapshots__/spending-cap.test.tsx.snap
@@ -69,7 +69,7 @@ exports[` renders component 1`] = `
class="mm-box mm-text mm-text--body-md mm-box--color-inherit"
style="white-space: pre-wrap;"
>
- 10
+ 1000
', () => {
const setIsOpenEditSpendingCapModal = () =>
console.log('setIsOpenEditSpendingCapModal');
- const customSpendingCap = '10';
const { container } = renderWithConfirmContextProvider(
,
mockStore,
diff --git a/ui/pages/confirmations/components/confirm/info/approve/spending-cap/spending-cap.tsx b/ui/pages/confirmations/components/confirm/info/approve/spending-cap/spending-cap.tsx
index 8f608dd0236f..16b6c3b9b053 100644
--- a/ui/pages/confirmations/components/confirm/info/approve/spending-cap/spending-cap.tsx
+++ b/ui/pages/confirmations/components/confirm/info/approve/spending-cap/spending-cap.tsx
@@ -99,8 +99,6 @@ export const SpendingCap = ({
decimals || '0',
);
- console.log({ transactionMeta, decodedSpendingCap: spendingCap });
-
if (pending) {
return ;
}