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
64d37b0f
Commit
64d37b0f
authored
Mar 26, 2020
by
aniket-engg
Committed by
Aniket
Mar 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test function with params will throw error
parent
28e8c1f8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
5 deletions
+4
-5
testRunner.ts
remix-tests/src/testRunner.ts
+3
-5
types.ts
remix-tests/src/types.ts
+1
-0
No files found.
remix-tests/src/testRunner.ts
View file @
64d37b0f
...
@@ -122,7 +122,7 @@ function createRunList (jsonInterface: FunctionDescription[], fileAST: AstNode,
...
@@ -122,7 +122,7 @@ function createRunList (jsonInterface: FunctionDescription[], fileAST: AstNode,
if
(
availableFunctions
.
indexOf
(
'beforeEach'
)
>=
0
)
{
if
(
availableFunctions
.
indexOf
(
'beforeEach'
)
>=
0
)
{
runList
.
push
({
name
:
'beforeEach'
,
type
:
'internal'
,
constant
:
false
,
payable
:
false
})
runList
.
push
({
name
:
'beforeEach'
,
type
:
'internal'
,
constant
:
false
,
payable
:
false
})
}
}
if
(
func
.
name
)
runList
.
push
({
name
:
func
.
name
,
signature
:
func
.
signature
,
type
:
'test'
,
constant
:
isConstant
(
func
),
payable
:
isPayable
(
func
)
})
if
(
func
.
name
&&
func
.
inputs
)
runList
.
push
({
name
:
func
.
name
,
inputs
:
func
.
inputs
,
signature
:
func
.
signature
,
type
:
'test'
,
constant
:
isConstant
(
func
),
payable
:
isPayable
(
func
)
})
if
(
availableFunctions
.
indexOf
(
'afterEach'
)
>=
0
)
{
if
(
availableFunctions
.
indexOf
(
'afterEach'
)
>=
0
)
{
runList
.
push
({
name
:
'afterEach'
,
type
:
'internal'
,
constant
:
false
,
payable
:
false
})
runList
.
push
({
name
:
'afterEach'
,
type
:
'internal'
,
constant
:
false
,
payable
:
false
})
}
}
...
@@ -142,14 +142,12 @@ export function runTest (testName: string, testObject: any, contractDetails: Com
...
@@ -142,14 +142,12 @@ export function runTest (testName: string, testObject: any, contractDetails: Com
const
isJSONInterfaceAvailable
=
testObject
&&
testObject
.
options
&&
testObject
.
options
.
jsonInterface
const
isJSONInterfaceAvailable
=
testObject
&&
testObject
.
options
&&
testObject
.
options
.
jsonInterface
if
(
!
isJSONInterfaceAvailable
)
if
(
!
isJSONInterfaceAvailable
)
return
resultsCallback
(
new
Error
(
'Contract interface not available'
),
{
passingNum
,
failureNum
,
timePassed
})
return
resultsCallback
(
new
Error
(
'Contract interface not available'
),
{
passingNum
,
failureNum
,
timePassed
})
const
runList
:
RunListInterface
[]
=
createRunList
(
testObject
.
options
.
jsonInterface
,
fileAST
,
testName
)
const
runList
:
RunListInterface
[]
=
createRunList
(
testObject
.
options
.
jsonInterface
,
fileAST
,
testName
)
const
web3
=
new
Web3
()
const
web3
=
new
Web3
()
const
accts
:
TestResultInterface
=
{
const
accts
:
TestResultInterface
=
{
type
:
'accountList'
,
type
:
'accountList'
,
value
:
opts
.
accounts
value
:
opts
.
accounts
}
}
testCallback
(
undefined
,
accts
)
testCallback
(
undefined
,
accts
)
const
resp
:
TestResultInterface
=
{
const
resp
:
TestResultInterface
=
{
...
@@ -157,7 +155,6 @@ export function runTest (testName: string, testObject: any, contractDetails: Com
...
@@ -157,7 +155,6 @@ export function runTest (testName: string, testObject: any, contractDetails: Com
value
:
testName
,
value
:
testName
,
filename
:
testObject
.
filename
filename
:
testObject
.
filename
}
}
testCallback
(
undefined
,
resp
)
testCallback
(
undefined
,
resp
)
async
.
eachOfLimit
(
runList
,
1
,
function
(
func
,
index
,
next
)
{
async
.
eachOfLimit
(
runList
,
1
,
function
(
func
,
index
,
next
)
{
let
sender
:
string
|
null
=
null
let
sender
:
string
|
null
=
null
...
@@ -169,6 +166,8 @@ export function runTest (testName: string, testObject: any, contractDetails: Com
...
@@ -169,6 +166,8 @@ export function runTest (testName: string, testObject: any, contractDetails: Com
}
}
let
sendParams
:
Record
<
string
,
string
>
|
null
=
null
let
sendParams
:
Record
<
string
,
string
>
|
null
=
null
if
(
sender
)
sendParams
=
{
from
:
sender
}
if
(
sender
)
sendParams
=
{
from
:
sender
}
if
(
func
.
inputs
&&
func
.
inputs
.
length
>
0
)
return
resultsCallback
(
new
Error
(
'Method inside a test contract can not have parameters'
),
{
passingNum
,
failureNum
,
timePassed
})
const
method
=
testObject
.
methods
[
func
.
name
].
apply
(
testObject
.
methods
[
func
.
name
],
[])
const
method
=
testObject
.
methods
[
func
.
name
].
apply
(
testObject
.
methods
[
func
.
name
],
[])
const
startTime
=
Date
.
now
()
const
startTime
=
Date
.
now
()
if
(
func
.
constant
)
{
if
(
func
.
constant
)
{
...
@@ -248,7 +247,6 @@ export function runTest (testName: string, testObject: any, contractDetails: Com
...
@@ -248,7 +247,6 @@ export function runTest (testName: string, testObject: any, contractDetails: Com
return
next
(
err
)
return
next
(
err
)
}
}
}).
on
(
'error'
,
function
(
err
:
Error
)
{
}).
on
(
'error'
,
function
(
err
:
Error
)
{
console
.
error
(
err
)
const
time
:
number
=
(
Date
.
now
()
-
startTime
)
/
1000.0
const
time
:
number
=
(
Date
.
now
()
-
startTime
)
/
1000.0
const
resp
:
TestResultInterface
=
{
const
resp
:
TestResultInterface
=
{
type
:
'testFailure'
,
type
:
'testFailure'
,
...
...
remix-tests/src/types.ts
View file @
64d37b0f
...
@@ -14,6 +14,7 @@ export interface FinalResult {
...
@@ -14,6 +14,7 @@ export interface FinalResult {
/** List of tests to run **/
/** List of tests to run **/
export
interface
RunListInterface
{
export
interface
RunListInterface
{
name
:
string
,
name
:
string
,
inputs
?:
any
[]
type
:
string
,
type
:
string
,
constant
:
boolean
,
constant
:
boolean
,
payable
:
boolean
,
payable
:
boolean
,
...
...
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