Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
680118f7
Unverified
Commit
680118f7
authored
Jun 08, 2022
by
Mark Tyneway
Committed by
GitHub
Jun 08, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2727 from ethereum-optimism/fix/broken-contracts-tests
contracts: fix broken contracts tests
parents
6fe58eb2
34f9be41
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
json-test-runner.ts
...es/contracts/test/helpers/test-runner/json-test-runner.ts
+8
-7
No files found.
packages/contracts/test/helpers/test-runner/json-test-runner.ts
View file @
680118f7
/* External Imports */
/* External Imports */
import
{
ethers
}
from
'
hardhat
'
import
{
ethers
}
from
'
hardhat
'
import
{
Contract
,
BigNumber
}
from
'
ethers
'
import
{
Contract
}
from
'
ethers
'
import
{
expect
}
from
'
../../setup
'
import
{
expect
}
from
'
../../setup
'
const
bigNumberify
=
(
arr
:
any
[])
=>
{
const
bigNumberify
=
(
arr
:
any
[])
=>
{
return
arr
.
map
((
el
:
any
)
=>
{
return
arr
.
map
((
el
:
any
)
=>
{
if
(
typeof
el
===
'
number
'
)
{
if
(
typeof
el
===
'
number
'
)
{
return
BigNumber
.
from
(
el
)
return
ethers
.
BigNumber
.
from
(
el
)
}
else
if
(
typeof
el
===
'
string
'
&&
/^
\d
+n$/gm
.
test
(
el
))
{
}
else
if
(
typeof
el
===
'
string
'
&&
/^
\d
+n$/gm
.
test
(
el
))
{
return
BigNumber
.
from
(
el
.
slice
(
0
,
el
.
length
-
1
))
return
ethers
.
BigNumber
.
from
(
el
.
slice
(
0
,
el
.
length
-
1
))
}
else
if
(
typeof
el
===
'
string
'
&&
el
.
length
>
2
&&
el
.
startsWith
(
'
0x
'
))
{
}
else
if
(
typeof
el
===
'
string
'
&&
el
.
length
>
2
&&
el
.
startsWith
(
'
0x
'
))
{
return
BigNumber
.
from
(
el
.
toLowerCase
())
return
ethers
.
BigNumber
.
from
(
el
.
toLowerCase
())
}
else
if
(
Array
.
isArray
(
el
))
{
}
else
if
(
Array
.
isArray
(
el
))
{
return
bigNumberify
(
el
)
return
bigNumberify
(
el
)
}
else
{
}
else
{
...
@@ -34,9 +34,10 @@ export const runJsonTest = (contractName: string, json: any): void => {
...
@@ -34,9 +34,10 @@ export const runJsonTest = (contractName: string, json: any): void => {
await
expect
(
contract
.
functions
[
functionName
](...
test
.
in
)).
to
.
be
await
expect
(
contract
.
functions
[
functionName
](...
test
.
in
)).
to
.
be
.
reverted
.
reverted
}
else
{
}
else
{
expect
(
const
result
=
await
contract
.
functions
[
functionName
](...
test
.
in
)
bigNumberify
(
await
contract
.
functions
[
functionName
](...
test
.
in
))
expect
(
JSON
.
stringify
(
bigNumberify
(
result
))).
to
.
deep
.
equal
(
).
to
.
deep
.
equal
(
bigNumberify
(
test
.
out
))
JSON
.
stringify
(
bigNumberify
(
test
.
out
))
)
}
}
})
})
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment