Skip to content

Commit a9c14f9

Browse files
authored
Merge pull request #4698 from stacks-network/test/pox-4-unit
PoX-4 unit testing
2 parents ac2bd50 + 9bce638 commit a9c14f9

File tree

19 files changed

+11666
-0
lines changed

19 files changed

+11666
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
**/settings/Mainnet.toml
3+
**/settings/Testnet.toml
4+
.cache/**
5+
history.txt
6+
7+
logs
8+
*.log
9+
npm-debug.log*
10+
coverage
11+
*.info
12+
costs-reports.json
13+
node_modules
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
{
3+
"files.eol": "\n"
4+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
{
3+
"version": "2.0.0",
4+
"tasks": [
5+
{
6+
"label": "check contracts",
7+
"group": "test",
8+
"type": "shell",
9+
"command": "clarinet check"
10+
},
11+
{
12+
"type": "npm",
13+
"script": "test",
14+
"group": "test",
15+
"problemMatcher": [],
16+
"label": "npm test"
17+
}
18+
]
19+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[project]
2+
name = 'boot-contracts-unit-tests'
3+
description = ''
4+
authors = []
5+
telemetry = false
6+
cache_dir = './.cache'
7+
requirements = []
8+
9+
[contracts.indirect]
10+
path = 'contracts/indirect.clar'
11+
clarity_version = 2
12+
epoch = 2.4
13+
14+
[repl.analysis]
15+
passes = ['check_checker']
16+
17+
[repl.analysis.check_checker]
18+
strict = false
19+
trusted_sender = false
20+
trusted_caller = false
21+
callee_filter = false
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Boot contracts unit tests
2+
3+
Run unit tests with clarinet on boot contracts.
4+
5+
Contracts tests:
6+
7+
- [x] pox-4.clar
8+
9+
10+
## About boot contract unit testing with Clarinet
11+
12+
- To really test contracts such as the pox contracts, we need to test the boot contracts embedded
13+
into Clarinet. For example `ST000000000000000000002AMW42H.pox-4.clar`
14+
- This mean that calling this contract will interact
15+
- Since the boot contracts are embedded into Clarinet, we only test the version of the contract
16+
that is in Clarinet, and not the ones that actually live in the stacks-core repository.
17+
18+
We are able to get the boot contracts coverage thanks to this settings in `vitest.config.js`:
19+
```js
20+
includeBootContracts: true,
21+
bootContractsPath: `${process.cwd()}/boot_contracts`,
22+
```
23+
A copy of the tested boot contracts is includedin this directory as well so that we are able to
24+
compute and render the code coverage.

0 commit comments

Comments
 (0)