Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
ece75953
Commit
ece75953
authored
Aug 18, 2021
by
aniket-engg
Committed by
Aniket
Aug 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests fixed
parent
dbb71b17
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
51 deletions
+51
-51
testRunner.ts
libs/remix-tests/src/testRunner.ts
+51
-51
No files found.
libs/remix-tests/src/testRunner.ts
View file @
ece75953
...
@@ -282,65 +282,65 @@ export function runTest (testName: string, testObject: any, contractDetails: Com
...
@@ -282,65 +282,65 @@ export function runTest (testName: string, testObject: any, contractDetails: Com
}
}
if
(
!
sendParams
)
sendParams
=
{}
if
(
!
sendParams
)
sendParams
=
{}
sendParams
.
gas
=
10000000
*
8
sendParams
.
gas
=
10000000
*
8
method
.
send
(
sendParams
).
on
(
'receipt'
,
(
receipt
)
=>
{
method
.
send
(
sendParams
).
on
(
'receipt'
,
async
(
receipt
)
=>
{
try
{
try
{
web3
.
eth
.
getHHLogsForTx
(
receipt
.
transactionHash
).
then
((
hhLogs
)
=>
{
let
hhLogs
const
time
:
number
=
(
Date
.
now
()
-
startTime
)
/
1000.0
if
(
web3
.
eth
&&
web3
.
eth
.
getHHLogsForTx
)
hhLogs
=
await
web3
.
eth
.
getHHLogsForTx
(
receipt
.
transactionHash
)
const
assertionEventHashes
=
assertionEvents
.
map
(
e
=>
Web3
.
utils
.
sha3
(
e
.
name
+
'('
+
e
.
params
.
join
()
+
')'
))
const
time
:
number
=
(
Date
.
now
()
-
startTime
)
/
1000.0
let
testPassed
=
false
const
assertionEventHashes
=
assertionEvents
.
map
(
e
=>
Web3
.
utils
.
sha3
(
e
.
name
+
'('
+
e
.
params
.
join
()
+
')'
))
for
(
const
i
in
receipt
.
events
)
{
let
testPassed
=
false
let
events
=
receipt
.
events
[
i
]
for
(
const
i
in
receipt
.
events
)
{
if
(
!
Array
.
isArray
(
events
))
events
=
[
events
]
let
events
=
receipt
.
events
[
i
]
for
(
const
event
of
events
)
{
if
(
!
Array
.
isArray
(
events
))
events
=
[
events
]
const
eIndex
=
assertionEventHashes
.
indexOf
(
event
.
raw
.
topics
[
0
])
// event name topic will always be at index 0
for
(
const
event
of
events
)
{
if
(
eIndex
>=
0
)
{
const
eIndex
=
assertionEventHashes
.
indexOf
(
event
.
raw
.
topics
[
0
])
// event name topic will always be at index 0
const
testEvent
=
web3
.
eth
.
abi
.
decodeParameters
(
assertionEvents
[
eIndex
].
params
,
event
.
raw
.
data
)
if
(
eIndex
>=
0
)
{
if
(
!
testEvent
[
0
])
{
const
testEvent
=
web3
.
eth
.
abi
.
decodeParameters
(
assertionEvents
[
eIndex
].
params
,
event
.
raw
.
data
)
const
assertMethod
=
testEvent
[
2
]
if
(
!
testEvent
[
0
])
{
if
(
assertMethod
===
'ok'
)
{
// for 'Assert.ok' method
const
assertMethod
=
testEvent
[
2
]
testEvent
[
3
]
=
'false'
if
(
assertMethod
===
'ok'
)
{
// for 'Assert.ok' method
testEvent
[
4
]
=
'true'
testEvent
[
3
]
=
'false'
}
testEvent
[
4
]
=
'true'
const
location
=
getAssertMethodLocation
(
fileAST
,
testName
,
func
.
name
,
assertMethod
)
const
resp
:
TestResultInterface
=
{
type
:
'testFailure'
,
value
:
changeCase
.
sentenceCase
(
func
.
name
),
filename
:
testObject
.
filename
,
time
:
time
,
errMsg
:
testEvent
[
1
],
context
:
testName
,
assertMethod
,
returned
:
testEvent
[
3
],
expected
:
testEvent
[
4
],
location
,
hhLogs
}
testCallback
(
undefined
,
resp
)
failureNum
+=
1
timePassed
+=
time
return
next
()
}
}
testPassed
=
true
const
location
=
getAssertMethodLocation
(
fileAST
,
testName
,
func
.
name
,
assertMethod
)
const
resp
:
TestResultInterface
=
{
type
:
'testFailure'
,
value
:
changeCase
.
sentenceCase
(
func
.
name
),
filename
:
testObject
.
filename
,
time
:
time
,
errMsg
:
testEvent
[
1
],
context
:
testName
,
assertMethod
,
returned
:
testEvent
[
3
],
expected
:
testEvent
[
4
],
location
,
}
if
(
hhLogs
)
resp
.
hhLogs
=
hhLogs
testCallback
(
undefined
,
resp
)
failureNum
+=
1
timePassed
+=
time
return
next
()
}
}
testPassed
=
true
}
}
}
}
}
if
(
testPassed
)
{
if
(
testPassed
)
{
const
resp
:
TestResultInterface
=
{
const
resp
:
TestResultInterface
=
{
type
:
'testPass'
,
type
:
'testPass'
,
value
:
changeCase
.
sentenceCase
(
func
.
name
),
value
:
changeCase
.
sentenceCase
(
func
.
name
),
filename
:
testObject
.
filename
,
filename
:
testObject
.
filename
,
time
:
time
,
time
:
time
,
context
:
testName
,
context
:
testName
,
hhLogs
}
testCallback
(
undefined
,
resp
)
passingNum
+=
1
timePassed
+=
time
}
}
if
(
hhLogs
)
resp
.
hhLogs
=
hhLogs
testCallback
(
undefined
,
resp
)
passingNum
+=
1
timePassed
+=
time
}
return
next
()
return
next
()
})
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
err
)
console
.
error
(
err
)
return
next
(
err
)
return
next
(
err
)
...
...
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