Skip to content

Commit 4b8d29e

Browse files
Sabnock01mds1
andauthored
chore: conform test naming to style guide (#433)
* chore: conform test naming to style guide * forge fmt * fix: StdAssertions failures * forge fmt * chore: add revert naming --------- Co-authored-by: Matt Solomon <[email protected]>
1 parent 7b4876e commit 4b8d29e

File tree

8 files changed

+241
-225
lines changed

8 files changed

+241
-225
lines changed

test/StdAssertions.t.sol

Lines changed: 93 additions & 77 deletions
Large diffs are not rendered by default.

test/StdChains.t.sol

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ contract StdChainsMock is Test {
2222
}
2323

2424
contract StdChainsTest is Test {
25-
function testChainRpcInitialization() public {
25+
function test_ChainRpcInitialization() public {
2626
// RPCs specified in `foundry.toml` should be updated.
2727
assertEq(getChain(1).rpcUrl, "https://mainnet.infura.io/v3/b1d3925804e74152b316ca7da97060d3");
2828
assertEq(getChain("optimism_goerli").rpcUrl, "https://goerli.optimism.io/");
@@ -43,7 +43,7 @@ contract StdChainsTest is Test {
4343
assertEq(getChain("sepolia").rpcUrl, "https://sepolia.infura.io/v3/b9794ad1ddf84dfb8c34d6bb5dca2001");
4444
}
4545

46-
function testRpc(string memory rpcAlias) internal {
46+
function testFuzz_Rpc(string memory rpcAlias) internal {
4747
string memory rpcUrl = getChain(rpcAlias).rpcUrl;
4848
vm.createSelectFork(rpcUrl);
4949
}
@@ -67,23 +67,23 @@ contract StdChainsTest is Test {
6767
// testRpc("gnosis_chain");
6868
// }
6969

70-
function testChainNoDefault() public {
70+
function test_ChainNoDefault() public {
7171
// We deploy a mock to properly test the revert.
7272
StdChainsMock stdChainsMock = new StdChainsMock();
7373

7474
vm.expectRevert("StdChains getChain(string): Chain with alias \"does_not_exist\" not found.");
7575
stdChainsMock.exposed_getChain("does_not_exist");
7676
}
7777

78-
function testSetChainFirstFails() public {
78+
function test_SetChainFirstFails() public {
7979
// We deploy a mock to properly test the revert.
8080
StdChainsMock stdChainsMock = new StdChainsMock();
8181

8282
vm.expectRevert("StdChains setChain(string,ChainData): Chain ID 31337 already used by \"anvil\".");
8383
stdChainsMock.exposed_setChain("anvil2", ChainData("Anvil", 31337, "URL"));
8484
}
8585

86-
function testChainBubbleUp() public {
86+
function test_ChainBubbleUp() public {
8787
// We deploy a mock to properly test the revert.
8888
StdChainsMock stdChainsMock = new StdChainsMock();
8989

@@ -94,7 +94,7 @@ contract StdChainsTest is Test {
9494
stdChainsMock.exposed_getChain("needs_undefined_env_var");
9595
}
9696

97-
function testCannotSetChain_ChainIdExists() public {
97+
function test_CannotSetChain_ChainIdExists() public {
9898
// We deploy a mock to properly test the revert.
9999
StdChainsMock stdChainsMock = new StdChainsMock();
100100

@@ -105,7 +105,7 @@ contract StdChainsTest is Test {
105105
stdChainsMock.exposed_setChain("another_custom_chain", ChainData("", 123456789, ""));
106106
}
107107

108-
function testSetChain() public {
108+
function test_SetChain() public {
109109
setChain("custom_chain", ChainData("Custom Chain", 123456789, "https://custom.chain/"));
110110
Chain memory customChain = getChain("custom_chain");
111111
assertEq(customChain.name, "Custom Chain");
@@ -131,47 +131,47 @@ contract StdChainsTest is Test {
131131
assertEq(chainById.chainId, 123456789);
132132
}
133133

134-
function testSetNoEmptyAlias() public {
134+
function test_SetNoEmptyAlias() public {
135135
// We deploy a mock to properly test the revert.
136136
StdChainsMock stdChainsMock = new StdChainsMock();
137137

138138
vm.expectRevert("StdChains setChain(string,ChainData): Chain alias cannot be the empty string.");
139139
stdChainsMock.exposed_setChain("", ChainData("", 123456789, ""));
140140
}
141141

142-
function testSetNoChainId0() public {
142+
function test_SetNoChainId0() public {
143143
// We deploy a mock to properly test the revert.
144144
StdChainsMock stdChainsMock = new StdChainsMock();
145145

146146
vm.expectRevert("StdChains setChain(string,ChainData): Chain ID cannot be 0.");
147147
stdChainsMock.exposed_setChain("alias", ChainData("", 0, ""));
148148
}
149149

150-
function testGetNoChainId0() public {
150+
function test_GetNoChainId0() public {
151151
// We deploy a mock to properly test the revert.
152152
StdChainsMock stdChainsMock = new StdChainsMock();
153153

154154
vm.expectRevert("StdChains getChain(uint256): Chain ID cannot be 0.");
155155
stdChainsMock.exposed_getChain(0);
156156
}
157157

158-
function testGetNoEmptyAlias() public {
158+
function test_GetNoEmptyAlias() public {
159159
// We deploy a mock to properly test the revert.
160160
StdChainsMock stdChainsMock = new StdChainsMock();
161161

162162
vm.expectRevert("StdChains getChain(string): Chain alias cannot be the empty string.");
163163
stdChainsMock.exposed_getChain("");
164164
}
165165

166-
function testChainIdNotFound() public {
166+
function test_ChainIdNotFound() public {
167167
// We deploy a mock to properly test the revert.
168168
StdChainsMock stdChainsMock = new StdChainsMock();
169169

170170
vm.expectRevert("StdChains getChain(string): Chain with alias \"no_such_alias\" not found.");
171171
stdChainsMock.exposed_getChain("no_such_alias");
172172
}
173173

174-
function testChainAliasNotFound() public {
174+
function test_ChainAliasNotFound() public {
175175
// We deploy a mock to properly test the revert.
176176
StdChainsMock stdChainsMock = new StdChainsMock();
177177

@@ -180,7 +180,7 @@ contract StdChainsTest is Test {
180180
stdChainsMock.exposed_getChain(321);
181181
}
182182

183-
function testSetChain_ExistingOne() public {
183+
function test_SetChain_ExistingOne() public {
184184
// We deploy a mock to properly test the revert.
185185
StdChainsMock stdChainsMock = new StdChainsMock();
186186

@@ -197,7 +197,7 @@ contract StdChainsTest is Test {
197197
assertEq(modifiedChain.rpcUrl, "https://modified.chain/");
198198
}
199199

200-
function testDontUseDefaultRpcUrl() public {
200+
function test_DontUseDefaultRpcUrl() public {
201201
// We deploy a mock to properly test the revert.
202202
StdChainsMock stdChainsMock = new StdChainsMock();
203203

0 commit comments

Comments
 (0)