From a04185917a6a020533adab716b5e8c83844d22c8 Mon Sep 17 00:00:00 2001
From: Sarah Schwartz <58856580+sarahschwartz@users.noreply.github.com>
Date: Wed, 24 Jul 2024 14:31:57 -0600
Subject: [PATCH] fix: cleanup
---
.../how-to-test-contracts/10.index.md | 60 ++++++++++---------
1 file changed, 31 insertions(+), 29 deletions(-)
diff --git a/content/tutorials/how-to-test-contracts/10.index.md b/content/tutorials/how-to-test-contracts/10.index.md
index 50578da8..323708d4 100644
--- a/content/tutorials/how-to-test-contracts/10.index.md
+++ b/content/tutorials/how-to-test-contracts/10.index.md
@@ -32,9 +32,9 @@ First, initialize a new Hardhat TypeScript project:
npx hardhat init
```
-Select the `Create a TypeScript project` option and install the sample project's dependencies `hardhat` and `@nomicfoundation/hardhat-toolbox`.
+Select the `Create a TypeScript project` option and install the sample project's dependencies: `hardhat` and `@nomicfoundation/hardhat-toolbox`.
-To install the `hardhat-zksync-node` plugin and additional necessary packages, execute the following command:
+To install the `hardhat-zksync-node` plugin, execute the following command:
@@ -152,6 +152,32 @@ import "@matterlabs/hardhat-zksync";
import "@nomicfoundation/hardhat-chai-matchers";
```
+With the previous steps completed, your `hardhat.config.ts` file should now be properly configured to include settings for local testing.
+
+
+
+```ts [hardhat.config.ts]
+import { HardhatUserConfig } from "hardhat/config";
+import "@nomicfoundation/hardhat-toolbox";
+import "@matterlabs/hardhat-zksync-node";
+import "@matterlabs/hardhat-zksync";
+import "@nomicfoundation/hardhat-chai-matchers";
+
+const config: HardhatUserConfig = {
+ solidity: "0.8.24",
+ zksolc: {
+ version: "latest",
+ },
+ networks: {
+ hardhat: {
+ zksync: true,
+ },
+ },
+};
+
+export default config;
+```
+
## Smart contract example
To set up the environment for using chai matchers and writing tests, you'll need to create some contracts.
@@ -195,35 +221,9 @@ contract Greeter {
## Write Test Cases
-With the previous steps completed, your `hardhat.config.ts` file should now be properly configured to include settings for local testing.
-
-
-
-```ts [hardhat.config.ts]
-import { HardhatUserConfig } from "hardhat/config";
-import "@nomicfoundation/hardhat-toolbox";
-import "@matterlabs/hardhat-zksync-node";
-import "@matterlabs/hardhat-zksync";
-import "@nomicfoundation/hardhat-chai-matchers";
-
-const config: HardhatUserConfig = {
- solidity: "0.8.24",
- zksolc: {
- version: "latest",
- },
- networks: {
- hardhat: {
- zksync: true,
- },
- },
-};
-
-export default config;
-```
-
Now you can create a test with the `hardhat-chai-matchers` plugin:
-Inside the `/test` folder, renamefile named `test.ts`.
+Inside the `/test` folder, rename the example test file to `test.ts`.
@@ -309,9 +309,11 @@ However, if you prefer to compile manually, simply run the following command `np
The `hardhat-zksync-node` plugin overrides the default behavior of the Hardhat `test` task.
It starts the **ZKsync Era Test Node** before running tests, executes the tests,
and then automatically shuts down the node after the test cases are completed.
+
Additionally, the plugin generates a log file named `era_test_node.log`,
which indicates the node's activity and transactions made during the tests.
Whenever you re-run the `test` command, the content of `era_test_node.log` is refreshed.
+
This setup ensures that your tests are executed against a controlled environment,
mimicking the behavior of a live network but in a local sandboxed context.
It's a common practice to ensure that smart contracts behave