Skip to content

Commit b6eff53

Browse files
committed
docs: added test instructions
1 parent 6f925c0 commit b6eff53

File tree

2 files changed

+34
-20
lines changed

2 files changed

+34
-20
lines changed

indexer/README.md

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -151,42 +151,56 @@ yarn dev:hot:graphql
151151
The following commands will aid in the maintenance of the indexer.
152152

153153
```bash
154-
# Identifying Missing Blocks - Scan for and store any blocks that were missed.
154+
# Identifying Missing Blocks - Scan for and store any blocks that were missed in the streaming process.
155155
yarn dev:missing
156156

157-
# Processing Headers - Start the header processing from S3 to the database.
158-
yarn dev:headers
159-
160-
# Processing Payloads - Start the payload processing from S3 to the database.
161-
yarn dev:payloads
162-
163157
# Update GraphQL - Makers a hot reload (without building)
164158
yarn dev:hot:graphql
165159

166160
# Generate GraphQL types - Generate the GraphQL types from the schema.
167161
yarn graphql:generate-types
162+
```
163+
164+
## 6. Running Tests
168165

169-
# Run the pagination tests offline
170-
yarn test
166+
The Kadena Indexer project includes several types of tests to ensure the functionality and reliability of the codebase. Below are the instructions to run these tests:
167+
168+
### 6.1. Unit Tests
169+
170+
Unit tests are designed to test individual components or functions in isolation. To run the unit tests, use the following command:
171+
172+
```bash
173+
yarn test:unit
171174
```
172175

173-
### 5.3. Local Workflow Testing
176+
This command will execute all the unit tests located in the `tests/unit` directory.
174177

175-
**NOTE:** This is not being actively maintained at the moment.
178+
### 6.2. Integration Tests
176179

177-
Install act for local testing:
180+
Integration tests are used to test the queries and subscriptions of the GraphQL API. To run the integration tests, use the following command:
178181

179182
```bash
180-
# For MacOS
181-
brew install act
183+
yarn test:integration
184+
```
185+
186+
This command will execute the integration tests located in the `tests/integration` directory, using the environment variables specified in the `.env.testing` file.
187+
188+
### 6.3. Specific Integration File Test
189+
190+
File tests are executed using the same environment as the integration tests. To run a specific integration test (eg. events), use the following command:
182191

183-
# For Linux
184-
sudo apt-get update
185-
sudo apt-get install act
192+
```bash
193+
yarn test:file tests/integration/events.query.test.ts
186194
```
187195

188-
Then run the indexer workflow by using the following command:
196+
This command will run tests using the environment variables from the `.env.testing` file.
197+
198+
### 6.4. Smoke Tests
199+
200+
Smoke tests are a subset of integration tests that verify the basic functionality of the application. To run the smoke tests, use the following command:
189201

190202
```bash
191-
yarn run-indexer-workflow
203+
yarn test:smoke
192204
```
205+
206+
This command will start the necessary services using Docker Compose, wait for a few seconds to ensure they are up and running, execute the smoke tests located in `tests/docker/smoke.test.ts`, and then shut down the services.

indexer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"test:unit": "jest tests/unit/*.test.ts",
7878
"test:integration": "dotenv -e .env.testing jest tests/integration/*.test.ts",
7979
"test:file": "dotenv -e .env.testing jest",
80-
"test:smoke": "yarn compose:up && sleep 5 && jest tests/integration/smoke.test.ts && yarn compose:down",
80+
"test:smoke": "yarn compose:up && sleep 5 && jest tests/docker/smoke.test.ts && yarn compose:down",
8181
"compose:up": "docker-compose -f docker-compose.yml up -d",
8282
"compose:down": "docker-compose -f docker-compose.yml down"
8383
}

0 commit comments

Comments
 (0)