You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/pages/en/developing/unit-testing-framework.mdx
+23-10Lines changed: 23 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,23 +2,32 @@
2
2
title: Unit Testing Framework
3
3
---
4
4
5
-
Matchstick is a unit testing framework, developed by [LimeChain](https://limechain.tech/), that enables subgraph developers to test their mapping logic in a sandboxed environment and deploy their subgraphs with confidence!
5
+
Learn how to use Matchstick, a unit testing framework developed by [LimeChain](https://limechain.tech/). Matchstick enables subgraph developers to test their mapping logic in a sandboxed environment and sucessfully deploy their subgraphs.
6
+
7
+
## Benefits of Using Matchstick
8
+
9
+
- It's written in Rust and optimized for high performance.
10
+
- It gives you access to developer features, including the ability to mock contract calls, make assertions about the store state, monitor subgraph failures, check test performance, and many more.
6
11
7
12
## Getting Started
8
13
9
-
### Install dependencies
14
+
### Install Dependencies
10
15
11
-
In order to use the test helper methods and run the tests, you will need to install the following dependencies:
16
+
In order to use the test helper methods and run tests, you need to install the following dependencies:
12
17
13
18
```sh
14
19
yarn add --dev matchstick-as
15
20
```
16
21
17
-
❗ `graph-node` depends on PostgreSQL, so if you don't already have it, you will need to install it. We highly advise using the commands below as adding it in any other way may cause unexpected errors!
22
+
### Install PostgreSQL
23
+
24
+
`graph-node` depends on PostgreSQL, so if you don't already have it, then you will need to install it.
25
+
26
+
> Note: It's highly recommended to use the commands below to avoid unexpected errors.
18
27
19
-
#### MacOS
28
+
#### Using MacOS
20
29
21
-
Postgres installation command:
30
+
Installation command:
22
31
23
32
```sh
24
33
brew install postgresql
@@ -30,15 +39,15 @@ Create a symlink to the latest libpq.5.lib _You may need to create this dir firs
Postgres installation command (depends on your distro):
44
+
Installation command (depends on your distro):
36
45
37
46
```sh
38
47
sudo apt install postgresql
39
48
```
40
49
41
-
### WSL (Windows Subsystem for Linux)
50
+
### Using WSL (Windows Subsystem for Linux)
42
51
43
52
You can use Matchstick on WSL both using the Docker approach and the binary approach. As WSL can be a bit tricky, here's a few tips in case you encounter issues like
44
53
@@ -76,7 +85,7 @@ And finally, do not use `graph test` (which uses your global installation of gra
76
85
}
77
86
```
78
87
79
-
### Usage
88
+
### Using Matchstick
80
89
81
90
To use **Matchstick** in your subgraph project just open up a terminal, navigate to the root folder of your project and simply run `graph test [options] <datasource>` - it downloads the latest **Matchstick** binary and runs the specified test or all tests in a test folder (or all existing tests if no datasource flag is specified).
82
91
@@ -1384,6 +1393,10 @@ This means you have used `console.log` in your code, which is not supported by A
1384
1393
1385
1394
The mismatch in arguments is caused by mismatch in`graph-ts` and `matchstick-as`. The best way to fix issues like this one is to update everything to the latest released version.
1386
1395
1396
+
## Additional Resources
1397
+
1398
+
For any additional support, check out this [demo subgraph repo using Matchstick](https://github.com/LimeChain/demo-subgraph#readme_).
1399
+
1387
1400
## Feedback
1388
1401
1389
1402
If you have any questions, feedback, feature requests or just want to reach out, the best place would be The Graph Discord where we have a dedicated channel for Matchstick, called 🔥| unit-testing.
0 commit comments