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
52ba2190
Commit
52ba2190
authored
Jul 23, 2020
by
aniket-engg
Committed by
Aniket
Jul 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests running fine using jest
parent
ea2afe98
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
21 additions
and
29 deletions
+21
-29
txRunner.js
libs/remix-lib/src/execution/txRunner.js
+1
-1
jest.config.js
libs/remix-tests/jest.config.js
+4
-1
package.json
libs/remix-tests/package.json
+1
-1
testRunner.spec.ts
libs/remix-tests/tests/testRunner.spec.ts
+12
-12
testRunner.ts
libs/remix-tests/tests/testRunner.ts
+0
-0
tsconfig.json
libs/remix-tests/tsconfig.json
+2
-0
tsconfig.spec.json
libs/remix-tests/tsconfig.spec.json
+0
-1
workspace.json
workspace.json
+1
-13
No files found.
libs/remix-lib/src/execution/txRunner.js
View file @
52ba2190
...
...
@@ -252,7 +252,7 @@ function run (self, tx, stamp, confirmationCb, gasEstimationForceSend, promptCb,
self
.
queusTxs
.
push
({
tx
,
stamp
,
callback
})
}
else
{
self
.
pendingTxs
[
stamp
]
=
tx
self
.
execute
(
tx
,
confirmationCb
,
gasEstimationForceSend
,
promptCb
,
(
error
,
result
)
=>
{
self
.
execute
(
tx
,
confirmationCb
,
gasEstimationForceSend
,
promptCb
,
function
(
error
,
result
)
{
delete
self
.
pendingTxs
[
stamp
]
callback
(
error
,
result
)
if
(
self
.
queusTxs
.
length
)
{
...
...
libs/remix-tests/jest.config.js
View file @
52ba2190
module
.
exports
=
{
name
:
'remix-tests'
,
preset
:
'../../jest.config.js'
,
verbose
:
true
,
transform
:
{
'^.+
\\
.[tj]sx?$'
:
'ts-jest'
,
},
testTimeout
:
30000
,
moduleFileExtensions
:
[
'ts'
,
'tsx'
,
'js'
,
'jsx'
,
'html'
,
'json'
,
'sol'
],
coverageDirectory
:
'../../coverage/libs/remix-tests'
,
coverageDirectory
:
'../../coverage/libs/remix-tests'
};
\ No newline at end of file
libs/remix-tests/package.json
View file @
52ba2190
...
...
@@ -19,7 +19,7 @@
},
"scripts"
:
{
"build"
:
"tsc"
,
"test"
:
"./../../node_modules/.bin/
mocha --require ts-node/register --require tsconfig-paths/register tests/testRunner.ts -t 300000
"
"test"
:
"./../../node_modules/.bin/
jest
"
},
"repository"
:
{
"type"
:
"git"
,
...
...
libs/remix-tests/tests/testRunner.spec.ts
View file @
52ba2190
...
...
@@ -40,7 +40,7 @@ function deepEqualExcluding(a: any, b: any, excludedKeys: string[]) {
}
let
accounts
:
string
[]
let
provider
=
new
Provider
()
let
provider
:
any
=
new
Provider
()
async
function
compileAndDeploy
(
filename
:
string
,
callback
:
Function
)
{
let
web3
:
Web3
=
new
Web3
()
...
...
@@ -101,7 +101,7 @@ describe('testRunner', () => {
describe
(
'#runTest'
,
()
=>
{
describe
(
'test with beforeAll'
,
()
=>
{
const
filename
:
string
=
'../tests
/examples_1/simple_storage_test.sol'
const
filename
:
string
=
__dirname
+
'
/examples_1/simple_storage_test.sol'
beforeAll
((
done
)
=>
{
compileAndDeploy
(
filename
,
(
_err
:
Error
|
null
|
undefined
,
compilationData
:
object
,
contracts
:
any
,
asts
:
any
,
accounts
:
string
[])
=>
{
...
...
@@ -122,7 +122,7 @@ describe('testRunner', () => {
it
(
'should return 6 messages'
,
()
=>
{
deepEqualExcluding
(
tests
,
[
{
type
:
'accountList'
,
value
:
accounts
},
{
type
:
'contract'
,
value
:
'MyTest'
,
filename
:
'tests
/examples_1/simple_storage_test.sol'
},
{
type
:
'contract'
,
value
:
'MyTest'
,
filename
:
__dirname
+
'
/examples_1/simple_storage_test.sol'
},
{
type
:
'testPass'
,
value
:
'Initial value should be100'
,
context
:
'MyTest'
},
{
type
:
'testPass'
,
value
:
'Initial value should not be200'
,
context
:
'MyTest'
},
{
type
:
'testFailure'
,
value
:
'Should trigger one fail'
,
errMsg
:
'uint test 1 fails'
,
context
:
'MyTest'
},
...
...
@@ -132,7 +132,7 @@ describe('testRunner', () => {
})
describe
(
'test with beforeEach'
,
()
=>
{
const
filename
:
string
=
'tests
/examples_2/simple_storage_test.sol'
const
filename
:
string
=
__dirname
+
'
/examples_2/simple_storage_test.sol'
beforeAll
(
done
=>
{
compileAndDeploy
(
filename
,
function
(
_err
:
Error
|
null
|
undefined
,
compilationData
:
object
,
contracts
:
any
,
asts
:
any
,
accounts
:
string
[])
{
...
...
@@ -153,7 +153,7 @@ describe('testRunner', () => {
it
(
'should return 4 messages'
,
()
=>
{
deepEqualExcluding
(
tests
,
[
{
type
:
'accountList'
,
value
:
accounts
},
{
type
:
'contract'
,
value
:
'MyTest'
,
filename
:
'tests
/examples_2/simple_storage_test.sol'
},
{
type
:
'contract'
,
value
:
'MyTest'
,
filename
:
__dirname
+
'
/examples_2/simple_storage_test.sol'
},
{
type
:
'testPass'
,
value
:
'Initial value should be100'
,
context
:
'MyTest'
},
{
type
:
'testPass'
,
value
:
'Value is set200'
,
context
:
'MyTest'
}
],
[
'time'
])
...
...
@@ -162,7 +162,7 @@ describe('testRunner', () => {
// Test string equality
describe
(
'test string equality'
,
()
=>
{
const
filename
:
string
=
'tests
/examples_3/simple_string_test.sol'
const
filename
:
string
=
__dirname
+
'
/examples_3/simple_string_test.sol'
beforeAll
(
done
=>
{
compileAndDeploy
(
filename
,
function
(
_err
:
Error
|
null
|
undefined
,
compilationData
:
object
,
contracts
:
any
,
asts
:
any
,
accounts
:
string
[])
{
...
...
@@ -179,7 +179,7 @@ describe('testRunner', () => {
it
(
'should return 4 messages'
,
()
=>
{
deepEqualExcluding
(
tests
,
[
{
type
:
'accountList'
,
value
:
accounts
},
{
type
:
'contract'
,
value
:
'StringTest'
,
filename
:
'tests
/examples_3/simple_string_test.sol'
},
{
type
:
'contract'
,
value
:
'StringTest'
,
filename
:
__dirname
+
'
/examples_3/simple_string_test.sol'
},
{
type
:
'testPass'
,
value
:
'Initial value should be hello world'
,
context
:
'StringTest'
},
{
type
:
'testPass'
,
value
:
'Value should not be hello wordl'
,
context
:
'StringTest'
}
],
[
'time'
])
...
...
@@ -188,7 +188,7 @@ describe('testRunner', () => {
// Test multiple directory import in test contract
describe
(
'test multiple directory import in test contract'
,
()
=>
{
const
filename
:
string
=
'tests
/examples_5/test/simple_storage_test.sol'
const
filename
:
string
=
__dirname
+
'
/examples_5/test/simple_storage_test.sol'
beforeAll
(
done
=>
{
compileAndDeploy
(
filename
,
function
(
_err
:
Error
|
null
|
undefined
,
compilationData
:
object
,
contracts
:
any
,
asts
:
any
,
accounts
:
string
[])
{
...
...
@@ -205,7 +205,7 @@ describe('testRunner', () => {
it
(
'should return 4 messages'
,
()
=>
{
deepEqualExcluding
(
tests
,
[
{
type
:
'accountList'
,
value
:
accounts
},
{
type
:
'contract'
,
value
:
'StorageResolveTest'
,
filename
:
'tests
/examples_5/test/simple_storage_test.sol'
},
{
type
:
'contract'
,
value
:
'StorageResolveTest'
,
filename
:
__dirname
+
'
/examples_5/test/simple_storage_test.sol'
},
{
type
:
'testPass'
,
value
:
'Initial value should be100'
,
context
:
'StorageResolveTest'
},
{
type
:
'testPass'
,
value
:
'Check if even'
,
context
:
'StorageResolveTest'
},
{
type
:
'testPass'
,
value
:
'Check if odd'
,
context
:
'StorageResolveTest'
}
...
...
@@ -215,7 +215,7 @@ describe('testRunner', () => {
//Test signed/unsigned integer weight
describe
(
'test number weight'
,
()
=>
{
const
filename
:
string
=
'tests
/number/number_test.sol'
const
filename
:
string
=
__dirname
+
'
/number/number_test.sol'
beforeAll
(
done
=>
{
compileAndDeploy
(
filename
,
function
(
_err
:
Error
|
null
|
undefined
,
compilationData
:
object
,
contracts
:
any
,
asts
:
any
,
accounts
:
string
[])
{
...
...
@@ -235,7 +235,7 @@ describe('testRunner', () => {
// Test Transaction with custom sender & value
describe
(
'various sender'
,
()
=>
{
const
filename
:
string
=
'tests
/various_sender/sender_and_value_test.sol'
const
filename
:
string
=
__dirname
+
'
/various_sender/sender_and_value_test.sol'
beforeAll
(
done
=>
{
compileAndDeploy
(
filename
,
function
(
_err
:
Error
|
null
|
undefined
,
compilationData
:
object
,
contracts
:
any
,
asts
:
any
,
accounts
:
string
[])
{
...
...
@@ -255,7 +255,7 @@ describe('testRunner', () => {
// Test `runTest` method without sending contract object (should throw error)
describe
(
'runTest method without contract json interface'
,
()
=>
{
const
filename
:
string
=
'tests
/various_sender/sender_and_value_test.sol'
const
filename
:
string
=
__dirname
+
'
/various_sender/sender_and_value_test.sol'
const
errorCallback
:
Function
=
(
done
)
=>
{
return
(
err
,
_results
)
=>
{
if
(
err
&&
err
.
message
.
includes
(
'Contract interface not available'
))
{
...
...
libs/remix-tests/tests/testRunner.ts
deleted
100644 → 0
View file @
ea2afe98
This diff is collapsed.
Click to expand it.
libs/remix-tests/tsconfig.json
View file @
52ba2190
...
...
@@ -3,6 +3,8 @@
"compilerOptions"
:
{
"types"
:
[
"node"
,
"jest"
],
"module"
:
"commonjs"
,
"allowJs"
:
true
,
"rootDir"
:
"./"
,
"esModuleInterop"
:
true
},
"include"
:
[
"**/*.ts"
]
...
...
libs/remix-tests/tsconfig.spec.json
View file @
52ba2190
...
...
@@ -6,7 +6,6 @@
"types"
:
[
"jest"
,
"node"
]
},
"include"
:
[
"**/*.sol"
,
"**/*.spec.ts"
,
"**/*.spec.tsx"
,
"**/*.spec.js"
,
...
...
workspace.json
View file @
52ba2190
...
...
@@ -348,22 +348,10 @@
}
},
"test"
:
{
"builder"
:
"@nrwl/workspace:run-commands"
,
"options"
:
{
"commands"
:
[
{
"command"
:
"./../../node_modules/.bin/npm-run-all test"
}
],
"cwd"
:
"libs/remix-tests"
}
},
"test2"
:
{
"builder"
:
"@nrwl/jest:jest"
,
"options"
:
{
"jestConfig"
:
"libs/remix-tests/jest.config.js"
,
"tsConfig"
:
"libs/remix-tests/tsconfig.spec.json"
,
"passWithNoTests"
:
true
"tsConfig"
:
"libs/remix-tests/tsconfig.spec.json"
}
},
"build"
:
{
...
...
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