Skip to content

Commit

Permalink
test: fix names
Browse files Browse the repository at this point in the history
  • Loading branch information
pcheremu committed Mar 7, 2024
1 parent 64cc6f2 commit 7e43c46
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 126 deletions.
36 changes: 18 additions & 18 deletions packages/integration-tests/tests/api/accounts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ describe("API module: Account", () => {

//@id1704
it("Verify /api?module=account&action=balancemulti response", async () => {
await helper.retryTestAction(async () => {
await helper.runRetriableTestAction(async () => {
apiRoute = `/api?module=account&action=balancemulti&address=${Wallets.richWalletAddress},${Wallets.mainWalletAddress}`;
const richWalletBalance = await helper.getBalanceETH(Wallets.richWalletAddress, "L2");
const mainWalletBalance = await helper.getBalanceETH(Wallets.mainWalletAddress, "L2");
const richWalletLowerCase = Wallets.richWalletAddress.toLowerCase();
const mainWalletLowerCase = Wallets.mainWalletAddress.toLowerCase();
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(response.body.result.length).toBeGreaterThan(1);
Expand All @@ -48,10 +48,10 @@ describe("API module: Account", () => {

//@id1703
it("Verify /api?module=account&action=balance response", async () => {
await helper.retryTestAction(async () => {
await helper.runRetriableTestAction(async () => {
const balance = await helper.getBalanceETH(Wallets.richWalletAddress, "L2");
apiRoute = `/api?module=account&action=balance&address=${Wallets.richWalletAddress}`;
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" }));
Expand All @@ -62,9 +62,9 @@ describe("API module: Account", () => {

//@id1705
it("Verify /api?module=account&action=tokenbalance response", async () => {
await helper.retryTestAction(async () => {
await helper.runRetriableTestAction(async () => {
apiRoute = `/api?module=account&action=tokenbalance&contractaddress=${Token.ETHER_ERC20_Address}&address=${Wallets.richWalletAddress}`;
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" }));
Expand All @@ -75,11 +75,11 @@ describe("API module: Account", () => {

//@id1702
it("Verify /api?module=account&action=txlist response", async () => {
await helper.retryTestAction(async () => {
await helper.runRetriableTestAction(async () => {
const blocks = await request(environment.blockExplorerAPI).get("/blocks");
const blockNumber = blocks.body.items[0].number;
apiRoute = `/api?module=account&action=txlist&page=1&offset=10&sort=desc&endblock=${blockNumber}&startblock=0&address=${Wallets.richWalletAddress}`;
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(response.body.result.length).toBeGreaterThan(1);
Expand Down Expand Up @@ -116,11 +116,11 @@ describe("API module: Account", () => {

//@id1852
it("Verify /api?module=account&action=txlistinternal&address=", async () => {
await helper.retryTestAction(async () => {
await helper.runRetriableTestAction(async () => {
const blocks = await request(environment.blockExplorerAPI).get("/blocks");
const blockNumber = blocks.body.items[0].number;
apiRoute = `/api?module=account&action=txlistinternal&page=1&offset=10&sort=desc&endblock=${blockNumber}&startblock=0&address=${Wallets.richWalletAddress}`;
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" }));
Expand All @@ -147,11 +147,11 @@ describe("API module: Account", () => {

//@id1804
it("Verify /api?module=account&action=txlistinternal", async () => {
await helper.retryTestAction(async () => {
await helper.runRetriableTestAction(async () => {
const blocks = await request(environment.blockExplorerAPI).get("/blocks");
const blockNumber = blocks.body.items[0].number;
apiRoute = `/api?module=account&action=txlistinternal&page=1&offset=10&sort=desc&endblock=${blockNumber}&startblock=1`;
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" }));
Expand All @@ -173,11 +173,11 @@ describe("API module: Account", () => {

//@id1805
it("Verify /api?module=account&action=tokentx", async () => {
await helper.retryTestAction(async () => {
await helper.runRetriableTestAction(async () => {
const blocks = await request(environment.blockExplorerAPI).get("/blocks");
const blockNumber = blocks.body.items[0].number;
apiRoute = `/api?module=account&action=tokentx&page=1&offset=10&sort=desc&endblock=${blockNumber}&startblock=0&contractaddress=${Token.ETHER_ERC20_Address}&address=${Wallets.richWalletAddress}`;
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);
console.log(apiRoute);

expect(response.status).toBe(200);
Expand Down Expand Up @@ -212,12 +212,12 @@ describe("API module: Account", () => {

//@id1806
it("Verify /api?module=account&action=tokennfttx", async () => {
await helper.retryTestAction(async () => {
await helper.runRetriableTestAction(async () => {
const blocks = await request(environment.blockExplorerAPI).get("/blocks");
const blockNumber = blocks.body.items[0].number;
const nftAddress = await helper.getStringFromFile(bufferFile + Buffer.NFTtoL2);
apiRoute = `/api?module=account&action=tokennfttx&page=1&offset=10&sort=desc&endblock=${blockNumber}&startblock=0&contractaddress=${nftAddress}&address=${nftAddress}`;
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" }));
Expand Down Expand Up @@ -246,9 +246,9 @@ describe("API module: Account", () => {

//@id1807
it("Verify /api?module=account&action=getminedblocks", async () => {
await helper.retryTestAction(async () => {
await helper.runRetriableTestAction(async () => {
apiRoute = `/api?module=account&action=getminedblocks&page=1&offset=10&address=0x0000000000000000000000000000000000000000`;
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" }));
Expand Down
32 changes: 16 additions & 16 deletions packages/integration-tests/tests/api/addresses.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ describe("Address", () => {

//@id1457
it("Verify deployed to L2 NFT via /address/{address}", async () => {
await helper.retryTestAction(async () => {
await helper.runRetriableTestAction(async () => {
token = await helper.getStringFromFile(bufferFile + Buffer.NFTtoL2);
apiRoute = `/address/${token}`;
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(response.body).toEqual(
Expand All @@ -51,11 +51,11 @@ describe("Address", () => {

//@id1464
it("Verify the deployed Root contract via /address/{address}", async () => {
await helper.retryTestAction(async () => {
await helper.runRetriableTestAction(async () => {
contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallRoot);
txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallRoot);
apiRoute = `/address/${contract}`;
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(response.body).toEqual(expect.objectContaining({ type: "contract" }));
Expand All @@ -68,11 +68,11 @@ describe("Address", () => {

//@id1465
it("Verify the deployed Middle contract via /address/{address}", async () => {
await helper.retryTestAction(async () => {
await helper.runRetriableTestAction(async () => {
contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallMiddle);
txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallMiddle);
apiRoute = `/address/${contract}`;
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(response.body).toEqual(expect.objectContaining({ type: "contract" }));
Expand All @@ -85,11 +85,11 @@ describe("Address", () => {

//@id1466
it("Verify the deployed Caller contract via /address/{address}", async () => {
await helper.retryTestAction(async () => {
await helper.runRetriableTestAction(async () => {
contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallCaller);
txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallCaller);
apiRoute = `/address/${contract}`;
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(response.body).toEqual(expect.objectContaining({ type: "contract" }));
Expand All @@ -102,10 +102,10 @@ describe("Address", () => {

//@id1476
it("Verify the deployed multitransfer contract via /address/{address}", async () => {
await helper.retryTestAction(async () => {
await helper.runRetriableTestAction(async () => {
contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiTransferETH);
apiRoute = `/address/${contract}`;
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(response.body).toEqual(expect.objectContaining({ address: contract }));
Expand All @@ -115,10 +115,10 @@ describe("Address", () => {

//@id1449
it("Verify the deployed Greeter contract via /address/{address}", async () => {
await helper.retryTestAction(async () => {
await helper.runRetriableTestAction(async () => {
contract = await helper.getStringFromFile(bufferFile + Buffer.greeterL2);
apiRoute = `/address/${contract}`;
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(response.body).toEqual(expect.objectContaining({ address: contract }));
Expand All @@ -134,12 +134,12 @@ describe("Address", () => {

//@id1510
it("Verify the transaction via /address/{address}/logs", async () => {
await helper.retryTestAction(async () => {
await helper.runRetriableTestAction(async () => {
contract = await helper.getStringFromFile(bufferFile + Buffer.greeterL2);
txHash = await helper.getStringFromFile(bufferFile + Buffer.executeGreeterTx);
apiRoute = `/address/${contract}/logs`;
const decapitalizedAddress = apiRoute.slice(1).toLowerCase();
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(response.body.items[0]).toEqual(expect.objectContaining({ address: contract }));
Expand Down Expand Up @@ -175,14 +175,14 @@ describe("Address", () => {

//@id1509
it("Verify the transaction via /address/{address}/transfers", async () => {
await helper.retryTestAction(async () => {
await helper.runRetriableTestAction(async () => {
contract = await helper.getStringFromFile(bufferFile + Buffer.paymaster);
const emptyWallet = await helper.getStringFromFile(bufferFile + Buffer.emptyWalletAddress);
txHash = await helper.getStringFromFile(bufferFile + Buffer.paymasterTx);
const customTokenAddress = await helper.getStringFromFile(bufferFile + Buffer.customToken);
apiRoute = `/address/${contract}/transfers`;
const decapitalizedAddress = apiRoute.slice(1).toLowerCase();
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: emptyWallet }));
Expand Down
10 changes: 5 additions & 5 deletions packages/integration-tests/tests/api/batches.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ describe("Batches", () => {

//@id1513
it("Verify the response via /batches", async () => {
await helper.retryTestAction(async () => {
await helper.runRetriableTestAction(async () => {
apiRoute = `/batches`;
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(Array.isArray(response.body.items)).toStrictEqual(true);
Expand Down Expand Up @@ -48,12 +48,12 @@ describe("Batches", () => {

//@id1514 //unstable due to null issue with timestamp
it("Verify the response via /batches/{batchNumber}", async () => {
await helper.retryTestAction(async () => {
await helper.runRetriableTestAction(async () => {
apiRoute = `/batches`;
const batches = await helper.performGETrequest(apiRoute);
const batches = await helper.performBlockExplorerApiGetRequest(apiRoute);
const batchNumber = batches.body.items[0].number;
apiRoute = apiRoute + `/${batchNumber}`;
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(response.body.number).toStrictEqual(batchNumber);
Expand Down
26 changes: 13 additions & 13 deletions packages/integration-tests/tests/api/blocks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ describe("Blocks", () => {
jest.setTimeout(localConfig.standardTimeout);
//@id1511
it("Verify the response via /blocks", async () => {
await helper.retryTestAction(async () => {
await helper.runRetriableTestAction(async () => {
apiRoute = `/blocks`;
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(Array.isArray(response.body.items)).toStrictEqual(true);
Expand All @@ -31,11 +31,11 @@ describe("Blocks", () => {

//@id1512 //unstable on CI
it("Verify the response via /blocks/{/blockNumber}", async () => {
await helper.retryTestAction(async () => {
const blocks = await helper.performGETrequest("/blocks");
await helper.runRetriableTestAction(async () => {
const blocks = await helper.performBlockExplorerApiGetRequest("/blocks");
const blockNumber = blocks.body.items[0].number;
apiRoute = `/blocks/${blockNumber}`;
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(response.body.number).toStrictEqual(blockNumber);
Expand Down Expand Up @@ -65,11 +65,11 @@ describe("Blocks", () => {
describe("/api?module=block", () => {
//@id1700
it("Verify /api?module=block&action=getblockcountdown&blockno={block_number} response", async () => {
await helper.retryTestAction(async () => {
const blocks = await helper.performGETrequest("/blocks");
await helper.runRetriableTestAction(async () => {
const blocks = await helper.performBlockExplorerApiGetRequest("/blocks");
const blockNumber = blocks.body.items[0].number + 1;
apiRoute = `/api?module=block&action=getblockcountdown&blockno=${blockNumber}`;
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" }));
Expand All @@ -83,9 +83,9 @@ describe("Blocks", () => {

//@id1699
it("Verify /api?module=block&action=getblocknobytime&closest=before&timestamp={timestamp} response", async () => {
await helper.retryTestAction(async () => {
await helper.runRetriableTestAction(async () => {
apiRoute = `/api?module=block&action=getblocknobytime&closest=before&timestamp=1635934550`;
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" }));
Expand All @@ -96,11 +96,11 @@ describe("Blocks", () => {

//@id1701
it("Verify /api?module=block&action=getblockreward&blockno={blockNumber} response", async () => {
await helper.retryTestAction(async () => {
const blocks = await helper.performGETrequest("/blocks");
await helper.runRetriableTestAction(async () => {
const blocks = await helper.performBlockExplorerApiGetRequest("/blocks");
const blockNumber = blocks.body.items[0].number;
apiRoute = `/api?module=block&action=getblockreward&blockno=${blockNumber}`;
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" }));
Expand Down
4 changes: 2 additions & 2 deletions packages/integration-tests/tests/api/contracts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ describe("API module: Contract", () => {

//@id1696
it("Verify /api?module=contract&action=getcontractcreation&contractaddresses={address1},{address2} response", async () => {
await helper.retryTestAction(async () => {
await helper.runRetriableTestAction(async () => {
paymasterContract = await helper.getStringFromFile(bufferFile + Buffer.paymaster);
paymasterTx = await helper.getStringFromFile(bufferFile + Buffer.paymasterDeployTx);
multicallCallerContract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallCaller);
multicallCallerTx = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallCaller);
apiRoute = `/api?module=contract&action=getcontractcreation&contractaddresses=${paymasterContract},${multicallCallerContract}`;
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(response.body.result[0]).toStrictEqual(expect.objectContaining({ contractAddress: paymasterContract }));
Expand Down
4 changes: 2 additions & 2 deletions packages/integration-tests/tests/api/logs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ describe("API module: Logs", () => {

//@id1808
it("Verify /api?module=logs&action=getLogs&page={page}&offset={offset}0&toBlock={toBlock}&fromBlock={fromBlock}&address={address} response", async () => {
await helper.retryTestAction(async () => {
await helper.runRetriableTestAction(async () => {
contractAddress = await helper.getStringFromFile(bufferFile + Buffer.greeterL2);
txHash = await helper.getStringFromFile(bufferFile + Buffer.executeGreeterTx);
apiRoute = `/api?module=logs&action=getLogs&page=1&offset=10&toBlock=10000&fromBlock=1&address=${contractAddress}`;
response = await helper.performGETrequest(apiRoute);
response = await helper.performBlockExplorerApiGetRequest(apiRoute);

expect(response.status).toBe(200);
expect(response.body.result[0]).toStrictEqual(expect.objectContaining({ address: contractAddress }));
Expand Down
Loading

0 comments on commit 7e43c46

Please sign in to comment.