Skip to content

Commit

Permalink
test: fix api tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pcheremu committed Jan 10, 2024
1 parent e8d4697 commit 6ca42f1
Show file tree
Hide file tree
Showing 4 changed files with 234 additions and 32 deletions.
6 changes: 3 additions & 3 deletions packages/integration-tests/tests/api/batches.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ describe("/batches", () => {
});

//@id1514
xit("Verify the response via /batches/{batchNumber}", async () => {
await setTimeout(localConfig.standardPause); //works unstable without timeout
it("Verify the response via /batches/{batchNumber}", async () => {
await setTimeout(localConfig.extendedPause); //works unstable without timeout

const batches = await request(environment.blockExplorerAPI).get("/batches");

Expand All @@ -56,6 +56,6 @@ describe("/batches", () => {
.expect((res) => expect(typeof res.body.l1GasPrice).toStrictEqual("string"))
.expect((res) => expect(typeof res.body.l2FairGasPrice).toStrictEqual("string"))
.expect((res) => expect(typeof res.body.size).toStrictEqual("number"))
.expect((res) => expect(res.body.status).toStrictEqual("string"));
.expect((res) => expect(typeof res.body.status).toStrictEqual("string"));
});
});
5 changes: 4 additions & 1 deletion packages/integration-tests/tests/api/contracts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { localConfig } from "../../src/config";
import { Buffer, Wallets } from "../../src/entities";
import { Helper } from "../../src/helper";
import { Playbook } from "../../src/playbook/playbook";
import { setTimeout } from 'timers/promises';

describe("Contracts API", () => {
jest.setTimeout(localConfig.standardTimeout);
Expand All @@ -24,12 +25,14 @@ describe("Contracts API", () => {
});

//@id1696
xit("Verify the response via /api?module=contract&action=getcontractcreation&contractaddresses={address1},{address2}", async () => {
it("Verify the response via /api?module=contract&action=getcontractcreation&contractaddresses={address1},{address2}", async () => {
await setTimeout(localConfig.standardPause);
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);
const apiRoute = `/api?module=contract&action=getcontractcreation&contractaddresses=${paymasterContract},${multicallCallerContract}`;
console.log("apiRoute: " + apiRoute);
return request(environment.blockExplorerAPI)
.get(apiRoute)
.expect(200)
Expand Down
4 changes: 3 additions & 1 deletion packages/integration-tests/tests/api/logs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import { localConfig } from "../../src/config";
import { Buffer } from "../../src/entities";
import { Helper } from "../../src/helper";
import { Playbook } from "../../src/playbook/playbook";
import { setTimeout } from 'timers/promises';

xdescribe("Logs API", () => {
describe("Logs API", () => {
jest.setTimeout(localConfig.standardTimeout); //works unstable without timeout
const helper = new Helper();
const bufferFile = "src/playbook/";
Expand All @@ -22,6 +23,7 @@ xdescribe("Logs API", () => {

//@id1808
it("Verify the response via /api?module=logs&action=getLogs&page={page}&offset={offset}0&toBlock={toBlock}&fromBlock={fromBlock}&address={address}", async () => {
await setTimeout(localConfig.standardPause);
contractAddress = await helper.getStringFromFile(bufferFile + Buffer.greeterL2);
txHash = await helper.getStringFromFile(bufferFile + Buffer.executeGreeterTx);

Expand Down
Loading

0 comments on commit 6ca42f1

Please sign in to comment.