Skip to content

Commit ea5cdcd

Browse files
committed
chore: boilerplate
Signed-off-by: Tomás Migone <[email protected]>
1 parent f1daade commit ea5cdcd

File tree

7 files changed

+52
-118
lines changed

7 files changed

+52
-118
lines changed

packages/contracts/contracts/staking/IHorizonStaking.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pragma solidity >=0.7.6 <0.9.0;
44
pragma abicoder v2;
55

66
interface Test {
7-
function test() external;
7+
function test() external returns (uint256);
88
}
99

1010
interface IHorizonStaking {

packages/subgraph-service/contracts/SubgraphService.sol

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@ pragma solidity >=0.4.0 <0.9.0;
44
import {Test} from "@graphprotocol/contracts/contracts/staking/IHorizonStaking.sol";
55

66
contract SimpleTest is Test {
7-
function test() external {}
7+
function test() external pure returns (uint256) {
8+
return 42;
9+
}
810
}

packages/subgraph-service/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"lint:sol": "forge fmt",
1010
"lint": "yarn lint:ts && yarn lint:sol",
1111
"clean": "rm -rf build cache typechain-types",
12-
"build": "hardhat compile"
12+
"build": "hardhat compile",
13+
"test": "forge test"
1314
},
1415
"devDependencies": {
1516
"@graphprotocol/contracts": "workspace:^7.0.0",
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@graphprotocol/contracts/=node_modules/@graphprotocol/contracts/
2+
forge-std/=lib/forge-std/src/
3+
ds-test/=lib/forge-std/lib/ds-test/src/
4+
eth-gas-reporter/=node_modules/eth-gas-reporter/
5+
hardhat/=node_modules/hardhat/

packages/subgraph-service/test/Lock.ts

-115
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// SPDX-License-Identifier: GPL-3.0
2+
pragma solidity 0.8.10;
3+
4+
import "forge-std/Test.sol";
5+
import { SimpleTest } from "../contracts/SubgraphService.sol";
6+
7+
contract ContractTest is Test {
8+
SimpleTest simpleTest;
9+
10+
function setUp() public {
11+
simpleTest = new SimpleTest();
12+
}
13+
14+
function test_NumberIs42() public {
15+
assertEq(simpleTest.test(), 42);
16+
}
17+
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import hardhat from 'hardhat'
2+
3+
import { expect } from 'chai'
4+
import { loadFixture } from '@nomicfoundation/hardhat-toolbox/network-helpers'
5+
6+
const ethers = hardhat.ethers
7+
8+
describe('SimpleTest', function () {
9+
async function deployFixture() {
10+
const [owner] = await ethers.getSigners()
11+
const SimpleTest = await ethers.getContractFactory('SimpleTest')
12+
const simpleTest = await SimpleTest.deploy()
13+
return { simpleTest, owner }
14+
}
15+
16+
describe('Deployment', function () {
17+
it('Should return 42', async function () {
18+
const { simpleTest } = await loadFixture(deployFixture)
19+
20+
expect(await simpleTest.test()).to.equal(42)
21+
})
22+
})
23+
})

0 commit comments

Comments
 (0)