Skip to content

Commit

Permalink
test: return global config back
Browse files Browse the repository at this point in the history
  • Loading branch information
pcheremu committed Aug 14, 2024
1 parent 036fcb4 commit 12aac45
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- qwe.test.ts
# - accounts.test.ts
# - addresses.test.ts
# - batches.test.ts
- batches.test.ts
# - blocks.test.ts
# - contracts.test.ts
# - logs.test.ts
Expand Down
16 changes: 6 additions & 10 deletions packages/integration-tests/src/helper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { exec } from "child_process";
import { ethers } from "ethers";
// import { promises as fs } from "fs";
import { promises as fs } from "fs";
import * as path from "path";
import * as request from "supertest";
import { Provider } from "zksync-ethers";
Expand Down Expand Up @@ -41,19 +41,15 @@ export class Helper {
}

async getStringFromFile(fileName: string) {
const absoluteRoute = new URL(`file://${path.join(__dirname, "..", fileName)}`);
await this.printLog("Ok, we are in getStringFromFile, absoluteRoute is " + absoluteRoute.href);
const absoluteRoute = path.join(__dirname, "..", fileName);
await this.printLog("Ok, we are in getStringFromFile, absoluteRoute is " + absoluteRoute);
try {
await this.printLog("Ok, we are in Return");
const response = await fetch(absoluteRoute.href);
if (!response.ok) {
throw new Error(`Failed to fetch the file: ${response.statusText}`);
}
const data = await response.text();
const data = await fs.readFile(absoluteRoute, { encoding: "utf-8" });
await this.printLog("File contains: " + data);
return data;
} catch (error) {
console.log(`There is no the expected file: ${fileName}`);
} catch {
console.log(`There is no the expected file: ${fileName}`);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ export const deployERC20toL2 = async function () {
const playbookRoot = path.join("src", "playbook");

await helper.printLog(`Before contract compilation: deployERC20toL2`);
await helper.executeScript(`npm --prefix ${playbookRoot} run compile`);
await helper.executeScript(`cd ${playbookRoot} && npm run compile`);

await helper.printLog(`Before contract deployment: deployERC20toL2`);
await helper.executeScript(`npm --prefix ${playbookRoot} run deployToL2`);
await helper.executeScript(`cd ${playbookRoot} && npm run deployToL2`);
// await helper.delay(5000);
await helper.printLog(`Return to the initial script: deployERC20toL2`);
const deployedToken = "0x0a691B9DC6C70CD946b5b170e9A781913ba40be7"; // await helper.getStringFromFile(bufferFile);
Expand Down
21 changes: 11 additions & 10 deletions packages/integration-tests/tests/hooks/global.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
// import { Buffer } from "../../src/entities";
// import { Helper } from "../../src/helper";
import * as path from "path";

import { Buffer } from "../../src/entities";
import { Helper } from "../../src/helper";
import { Playbook } from "../../src/playbook/playbook";

export default async () => {
console.log("A stub");
const playbook = new Playbook();
// const helper = new Helper();
// const bufferRoute = "src/playbook/";
const helper = new Helper();
const bufferRoute = path.join("src", "playbook");

// await playbook.compileContracts();
await playbook.deployERC20toL2();
// await playbook.deployERC20toL1();
// await playbook.depositETH("0.0000001");
// const bufferFile = bufferRoute + Buffer.L1;
// const token = await helper.getStringFromFile(bufferFile);
// await playbook.depositERC20("100", token, 18);
await playbook.deployERC20toL1();
await playbook.depositETH("0.0000001");
const bufferFile = path.join(bufferRoute, Buffer.L1);
const token = await helper.getStringFromFile(bufferFile);
await playbook.depositERC20("100", token, 18);
console.log("Final step in global == == ==");
};

0 comments on commit 12aac45

Please sign in to comment.