mirror of
https://github.com/Instadapp/chains.git
synced 2024-07-29 22:37:19 +00:00
Test to cover this case (#1833)
* Test to cover this case * Fail in case of leading zero(es)
This commit is contained in:
parent
43886b87eb
commit
3418667a05
|
@ -202,7 +202,7 @@ fun checkChain(chainFile: File, connectRPC: Boolean, verbose: Boolean = false) {
|
||||||
val chainAsLong = getNumber(jsonObject, "chainId")
|
val chainAsLong = getNumber(jsonObject, "chainId")
|
||||||
|
|
||||||
if (chainFile.nameWithoutExtension.startsWith("eip155-")) {
|
if (chainFile.nameWithoutExtension.startsWith("eip155-")) {
|
||||||
if (chainAsLong != chainFile.nameWithoutExtension.replace("eip155-", "").toLongOrNull()) {
|
if (chainAsLong.toString() != chainFile.nameWithoutExtension.replace("eip155-", "")) {
|
||||||
throw (FileNameMustMatchChainId())
|
throw (FileNameMustMatchChainId())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -128,6 +128,13 @@ class TheChainChecker {
|
||||||
checkChain(file, false)
|
checkChain(file, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(expected = FileNameMustMatchChainId::class)
|
||||||
|
fun shouldFailForFilenameWithLeadingZero() {
|
||||||
|
val file = getFile("invalid/leadingzero/eip155-01.json")
|
||||||
|
|
||||||
|
checkChain(file, false)
|
||||||
|
}
|
||||||
|
|
||||||
@Test(expected = FileNameMustMatchChainId::class)
|
@Test(expected = FileNameMustMatchChainId::class)
|
||||||
fun shouldFailForChainNotMatchingFilename() {
|
fun shouldFailForChainNotMatchingFilename() {
|
||||||
val file = getFile("invalid/eip155-3.json")
|
val file = getFile("invalid/eip155-3.json")
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"name": "Ethereum Mainnet",
|
||||||
|
"shortName": "eth",
|
||||||
|
"chain": "ETH",
|
||||||
|
"chainId": 1,
|
||||||
|
"networkId": 1,
|
||||||
|
"rpc": [
|
||||||
|
"https://mainnet.infura.io/v3/${INFURA_API_KEY}",
|
||||||
|
"https://api.mycryptoapi.com/eth"
|
||||||
|
],
|
||||||
|
"faucets": [],
|
||||||
|
"infoURL": "https://ethereum.org",
|
||||||
|
"nativeCurrency": {
|
||||||
|
"name": "Ether",
|
||||||
|
"symbol": "ETH",
|
||||||
|
"decimals": 18
|
||||||
|
},
|
||||||
|
"explorers": [{
|
||||||
|
"name": "etherscan",
|
||||||
|
"url": "https://etherscan.io",
|
||||||
|
"standard": "none"
|
||||||
|
}]
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user