From fa1f16ad169a234df070c485148b3e5d2b67cdf7 Mon Sep 17 00:00:00 2001 From: Jiexi Luan Date: Thu, 11 Apr 2024 09:40:07 -0700 Subject: [PATCH] update spec --- src/wallet.test.ts | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/src/wallet.test.ts b/src/wallet.test.ts index d6b9f6da..b4aa162e 100644 --- a/src/wallet.test.ts +++ b/src/wallet.test.ts @@ -56,7 +56,7 @@ describe('wallet', () => { }); describe('transactions', () => { - it('processes transaction with valid address', async () => { + it('processes transaction with valid address and data field', async () => { const { engine } = createTestSetup(); const getAccounts = async () => testAddresses.slice(0, 2); const witnessedTxParams: TransactionParams[] = []; @@ -90,6 +90,7 @@ describe('wallet', () => { engine.push(createWalletMiddleware({ getAccounts, processTransaction })); const txParams = { from: '0x3d', + data: '0x0', }; const payload = { method: 'eth_sendTransaction', params: [txParams] }; @@ -109,6 +110,7 @@ describe('wallet', () => { engine.push(createWalletMiddleware({ getAccounts, processTransaction })); const txParams = { from: testUnkownAddress, + data: '0x0', }; const payload = { method: 'eth_sendTransaction', params: [txParams] }; @@ -118,29 +120,6 @@ describe('wallet', () => { ); }); - it('processes transaction with data field but without input field', async () => { - const { engine } = createTestSetup(); - const getAccounts = async () => testAddresses.slice(0, 2); - const witnessedTxParams: TransactionParams[] = []; - const processTransaction = async (_txParams: TransactionParams) => { - witnessedTxParams.push(_txParams); - return testTxHash; - }; - engine.push(createWalletMiddleware({ getAccounts, processTransaction })); - const txParams = { - from: testAddresses[0], - data: '0x0', - }; - - const payload = { method: 'eth_sendTransaction', params: [txParams] }; - const sendTxResponse = await pify(engine.handle).call(engine, payload); - const sendTxResult = sendTxResponse.result; - expect(sendTxResult).toBeDefined(); - expect(sendTxResult).toStrictEqual(testTxHash); - expect(witnessedTxParams).toHaveLength(1); - expect(witnessedTxParams[0]).toStrictEqual(txParams); - }); - it('processes transaction with input field but without data field', async () => { const { engine } = createTestSetup(); const getAccounts = async () => testAddresses.slice(0, 2);