Skip to content

Commit

Permalink
Replaces file name string with constant variables
Browse files Browse the repository at this point in the history
Signed-off-by: Konstantina Blazhukova <konstantina.blajukova@gmail.com>
  • Loading branch information
konstantinabl committed Sep 12, 2023
1 parent efe9816 commit 4c1bb3d
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions packages/server/tests/acceptance/conformityTests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ const gasPrice = '0x2C68AF0BB14000';
const gasLimit = '0x3D090';
const value = '0x2E90EDD000';
const localNodeAccountPrivateKey = '0x6e9d61a325be3f6675cf8b7676c70e4a004d2308e3e182370a41f5653d52c6bd';
const accessListFileName = 'get-access-list.io';
const dynamicFeeFileName = 'get-dynamic-fee.io';
const emptyTxFileName = 'get-empty-tx.io';
const legacyCreateFileName = 'get-legacy-create.io';
const legacyInputFileName = 'get-legacy-input.io';
const legacyContractFileName = 'get-legacy-contract.io';
const legacyTxFileName = 'get-legacy-tx.io';
const legacyReceiptFileName = 'get-legacy-receipt.io';
const notFoundTxFileName = 'get-notfound-tx.io';

let legacyTransaction = {
chainId: 0x12a,
Expand Down Expand Up @@ -181,7 +190,7 @@ function checkResponseFormat(fileName, actualReponse, expectedResponse) {
const actualResponseKeys = extractKeys(actualReponse);
const expectedResponseKeys = extractKeys(expectedResponse);
const missingKeys = expectedResponseKeys.filter((key) => !actualResponseKeys.includes(key));
if ((fileName === 'get-dynamic-fee.io' || fileName === 'get-access-list.io') && missingKeys[0] === 'result.v') {
if ((fileName === dynamicFeeFileName || fileName === accessListFileName) && missingKeys[0] === 'result.v') {
return [];
}

Expand Down Expand Up @@ -213,31 +222,31 @@ function formatTransactionByHashAndReceiptRequests(fileName, request) {
* @returns {Object} - The formatted request containing updated transaction and block hashes.
*/
switch (fileName) {
case 'get-access-list.io':
case accessListFileName:
request.params[0] = transaction2930AndBlockHash.transactionHash;
break;
case 'get-dynamic-fee.io':
case dynamicFeeFileName:
request.params[0] = transaction1559AndBlockHash.transactionHash;
break;
case 'get-empty-tx.io':
case emptyTxFileName:
request.params[0] = '0x0000000000000000000000000000000000000000000000000000000000000000';
break;
case 'get-legacy-create.io':
case legacyCreateFileName:
request.params[0] = createContractLegacyTransactionAndBlockHash.transactionHash;
break;
case 'get-legacy-input.io':
case legacyInputFileName:
request.params[0] = createContractLegacyTransactionAndBlockHash.transactionHash;
break;
case 'get-legacy-contract.io':
case legacyContractFileName:
request.params[0] = createContractLegacyTransactionAndBlockHash.transactionHash;
break;
case 'get-legacy-tx.io':
case legacyTxFileName:
request.params[0] = legacyTransactionAndBlockHash.transactionHash;
break;
case 'get-legacy-receipt.io':
case legacyReceiptFileName:
request.params[0] = legacyTransactionAndBlockHash.transactionHash;
break;
case 'get-notfound-tx.io':
case notFoundTxFileName:
request.params[0] = '0x00000000000000000000000000000000000000000000000000000000deadbeef';
break;
}
Expand Down

0 comments on commit 4c1bb3d

Please sign in to comment.