File tree 7 files changed +52
-118
lines changed
contracts/contracts/staking
7 files changed +52
-118
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ pragma solidity >=0.7.6 <0.9.0;
4
4
pragma abicoder v2;
5
5
6
6
interface Test {
7
- function test () external ;
7
+ function test () external returns ( uint256 ) ;
8
8
}
9
9
10
10
interface IHorizonStaking {
Original file line number Diff line number Diff line change @@ -4,5 +4,7 @@ pragma solidity >=0.4.0 <0.9.0;
4
4
import {Test} from "@graphprotocol/contracts/contracts/staking/IHorizonStaking.sol " ;
5
5
6
6
contract SimpleTest is Test {
7
- function test () external {}
7
+ function test () external pure returns (uint256 ) {
8
+ return 42 ;
9
+ }
8
10
}
Original file line number Diff line number Diff line change 9
9
"lint:sol" : " forge fmt" ,
10
10
"lint" : " yarn lint:ts && yarn lint:sol" ,
11
11
"clean" : " rm -rf build cache typechain-types" ,
12
- "build" : " hardhat compile"
12
+ "build" : " hardhat compile" ,
13
+ "test" : " forge test"
13
14
},
14
15
"devDependencies" : {
15
16
"@graphprotocol/contracts" : " workspace:^7.0.0" ,
Original file line number Diff line number Diff line change
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/
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
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 number Diff line number Diff line change
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
+ } )
You can’t perform that action at this time.
0 commit comments