Skip to content

Commit

Permalink
Matchstick Copy Edits (#805)
Browse files Browse the repository at this point in the history
Edits
  • Loading branch information
idalithb authored Oct 25, 2024
1 parent 4a0d858 commit fc5b636
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion website/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
// see https://nextjs.org/docs/basic-features/typescript for more information.
33 changes: 23 additions & 10 deletions website/pages/en/developing/unit-testing-framework.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,32 @@
title: Unit Testing Framework
---

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!
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.

## Benefits of Using Matchstick

- It's written in Rust and optimized for high performance.
- 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.

## Getting Started

### Install dependencies
### Install Dependencies

In order to use the test helper methods and run the tests, you will need to install the following dependencies:
In order to use the test helper methods and run tests, you need to install the following dependencies:

```sh
yarn add --dev matchstick-as
```

`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!
### Install PostgreSQL

`graph-node` depends on PostgreSQL, so if you don't already have it, then you will need to install it.

> Note: It's highly recommended to use the commands below to avoid unexpected errors.
#### MacOS
#### Using MacOS

Postgres installation command:
Installation command:

```sh
brew install postgresql
Expand All @@ -30,15 +39,15 @@ Create a symlink to the latest libpq.5.lib _You may need to create this dir firs
ln -sf /usr/local/opt/postgresql@14/lib/postgresql@14/libpq.5.dylib /usr/local/opt/postgresql/lib/libpq.5.dylib
```

#### Linux
#### Using Linux

Postgres installation command (depends on your distro):
Installation command (depends on your distro):

```sh
sudo apt install postgresql
```

### WSL (Windows Subsystem for Linux)
### Using WSL (Windows Subsystem for Linux)

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

Expand Down Expand Up @@ -76,7 +85,7 @@ And finally, do not use `graph test` (which uses your global installation of gra
}
```

### Usage
### Using Matchstick

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).

Expand Down Expand Up @@ -1384,6 +1393,10 @@ This means you have used `console.log` in your code, which is not supported by A
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.
## Additional Resources
For any additional support, check out this [demo subgraph repo using Matchstick](https://github.com/LimeChain/demo-subgraph#readme_).
## Feedback
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 comments on commit fc5b636

Please sign in to comment.