Skip to content

Commit

Permalink
chore: boilerplate
Browse files Browse the repository at this point in the history
Signed-off-by: Tomás Migone <[email protected]>
  • Loading branch information
tmigone committed Mar 18, 2024
1 parent f1daade commit ea5cdcd
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 118 deletions.
2 changes: 1 addition & 1 deletion packages/contracts/contracts/staking/IHorizonStaking.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity >=0.7.6 <0.9.0;
pragma abicoder v2;

interface Test {
function test() external;
function test() external returns (uint256);
}

interface IHorizonStaking {
Expand Down
4 changes: 3 additions & 1 deletion packages/subgraph-service/contracts/SubgraphService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ pragma solidity >=0.4.0 <0.9.0;
import {Test} from "@graphprotocol/contracts/contracts/staking/IHorizonStaking.sol";

contract SimpleTest is Test {
function test() external {}
function test() external pure returns (uint256) {
return 42;
}
}
3 changes: 2 additions & 1 deletion packages/subgraph-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"lint:sol": "forge fmt",
"lint": "yarn lint:ts && yarn lint:sol",
"clean": "rm -rf build cache typechain-types",
"build": "hardhat compile"
"build": "hardhat compile",
"test": "forge test"
},
"devDependencies": {
"@graphprotocol/contracts": "workspace:^7.0.0",
Expand Down
5 changes: 5 additions & 0 deletions packages/subgraph-service/remappings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@graphprotocol/contracts/=node_modules/@graphprotocol/contracts/
forge-std/=lib/forge-std/src/
ds-test/=lib/forge-std/lib/ds-test/src/
eth-gas-reporter/=node_modules/eth-gas-reporter/
hardhat/=node_modules/hardhat/
115 changes: 0 additions & 115 deletions packages/subgraph-service/test/Lock.ts

This file was deleted.

18 changes: 18 additions & 0 deletions packages/subgraph-service/test/SimpleTest.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.10;

import "forge-std/Test.sol";
import { SimpleTest } from "../contracts/SubgraphService.sol";

contract ContractTest is Test {
SimpleTest simpleTest;

function setUp() public {
simpleTest = new SimpleTest();
}

function test_NumberIs42() public {
assertEq(simpleTest.test(), 42);
}

}
23 changes: 23 additions & 0 deletions packages/subgraph-service/test/SimpleTest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import hardhat from 'hardhat'

import { expect } from 'chai'
import { loadFixture } from '@nomicfoundation/hardhat-toolbox/network-helpers'

const ethers = hardhat.ethers

describe('SimpleTest', function () {
async function deployFixture() {
const [owner] = await ethers.getSigners()
const SimpleTest = await ethers.getContractFactory('SimpleTest')
const simpleTest = await SimpleTest.deploy()
return { simpleTest, owner }
}

describe('Deployment', function () {
it('Should return 42', async function () {
const { simpleTest } = await loadFixture(deployFixture)

expect(await simpleTest.test()).to.equal(42)
})
})
})

0 comments on commit ea5cdcd

Please sign in to comment.