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
4e1752dd
Commit
4e1752dd
authored
Aug 29, 2018
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tests; update web3.js
parent
c91ff433
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
140 additions
and
1 deletion
+140
-1
package.json
remix-simulator/package.json
+3
-0
accounts.js
remix-simulator/test/accounts.js
+19
-0
blocks.js
remix-simulator/test/blocks.js
+48
-0
misc.js
remix-simulator/test/misc.js
+50
-0
whisper.js
remix-simulator/test/whisper.js
+19
-0
package.json
remix-tests/package.json
+1
-1
No files found.
remix-simulator/package.json
View file @
4e1752dd
...
@@ -82,5 +82,8 @@
...
@@ -82,5 +82,8 @@
}
}
]
]
]
]
},
"devDependencies"
:
{
"mocha"
:
"^5.2.0"
}
}
}
}
remix-simulator/test/accounts.js
0 → 100644
View file @
4e1752dd
var
Web3
=
require
(
'web3'
)
var
RemixSim
=
require
(
'../index.js'
)
let
web3
=
new
Web3
()
var
assert
=
require
(
'assert'
)
describe
(
"Accounts"
,
function
()
{
before
(
function
()
{
let
provider
=
new
RemixSim
.
Provider
()
web3
.
setProvider
(
provider
)
})
it
(
"should get a list of accounts"
,
async
function
()
{
let
accounts
=
await
web3
.
eth
.
getAccounts
()
assert
.
notEqual
(
accounts
.
length
,
0
)
})
});
remix-simulator/test/blocks.js
0 → 100644
View file @
4e1752dd
var
Web3
=
require
(
'web3'
)
var
RemixSim
=
require
(
'../index.js'
)
let
web3
=
new
Web3
();
var
assert
=
require
(
'assert'
)
describe
(
"blocks"
,
function
()
{
before
(
function
()
{
let
provider
=
new
RemixSim
.
Provider
()
web3
.
setProvider
(
provider
)
})
it
(
"should get block given its number"
,
async
function
()
{
let
block
=
await
web3
.
eth
.
getBlock
(
1
)
let
expectedBlock
=
{
difficulty
:
'0'
,
extraData
:
'0x'
,
gasLimit
:
8000000
,
gasUsed
:
0
,
hash
:
'0xdb731f3622ef37b4da8db36903de029220dba74c41185f8429f916058b86559f'
,
logsBloom
:
'0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
,
miner
:
'0x3333333333333333333333333333333333333333'
,
mixHash
:
'0x0000000000000000000000000000000000000000000000000000000000000000'
,
nonce
:
'0x0000000000000042'
,
number
:
0
,
parentHash
:
'0x0000000000000000000000000000000000000000000000000000000000000000'
,
receiptsRoot
:
'0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421'
,
sha3Uncles
:
'0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347'
,
size
:
504
,
stateRoot
:
'0xb7917653f92e62394d2207d0f39a1320ff1cb93d1cee80d3c492627e00b219ff'
,
timestamp
:
0
,
totalDifficulty
:
'0'
,
transactions
:
[],
transactionsRoot
:
'0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421'
,
uncles
:
[]
}
assert
.
deepEqual
(
block
,
expectedBlock
)
})
it
(
"should get gas price"
,
async
function
()
{
let
gasPrice
=
await
web3
.
eth
.
getGasPrice
()
assert
.
equal
(
gasPrice
,
1
)
})
});
remix-simulator/test/misc.js
0 → 100644
View file @
4e1752dd
var
Web3
=
require
(
'web3'
)
var
RemixSim
=
require
(
'../index.js'
)
let
web3
=
new
Web3
();
var
assert
=
require
(
'assert'
)
describe
(
"Misc"
,
function
()
{
before
(
function
()
{
let
provider
=
new
RemixSim
.
Provider
()
web3
.
setProvider
(
provider
)
})
it
(
"should get correct remix simulator version"
,
async
function
(
done
)
{
web3
.
_requestManager
.
send
({
method
:
'web3_clientVersion'
,
params
:
[]},
(
err
,
version
)
=>
{
let
remix_version
=
require
(
'../package.json'
).
version
assert
.
equal
(
version
,
"Remix Simulator/"
+
remix_version
)
done
();
})
})
it
(
"should get protocol version"
,
async
function
()
{
web3
.
_requestManager
.
send
({
method
:
'eth_protocolVersion'
,
params
:
[]},
(
err
,
result
)
=>
{
assert
.
equal
(
result
,
"0x3f"
)
})
})
it
(
"should get if is syncing"
,
async
function
()
{
let
isSyncing
=
await
web3
.
eth
.
isSyncing
()
assert
.
equal
(
isSyncing
,
false
)
})
it
(
"should get if is mining"
,
async
function
()
{
let
isMining
=
await
web3
.
eth
.
isMining
()
assert
.
equal
(
isMining
,
false
)
})
it
(
"should get hashrate"
,
async
function
()
{
let
hashrate
=
await
web3
.
eth
.
getHashrate
()
assert
.
equal
(
hashrate
,
0
)
})
it
(
"should get result of a sha3"
,
async
function
()
{
web3
.
_requestManager
.
send
({
method
:
'web3_sha3'
,
params
:
[
"0x68656c6c6f20776f726c64"
]},
(
err
,
result
)
=>
{
assert
.
equal
(
result
,
"0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad"
)
})
})
});
remix-simulator/test/whisper.js
0 → 100644
View file @
4e1752dd
var
Web3
=
require
(
'web3'
)
var
RemixSim
=
require
(
'../index.js'
)
let
web3
=
new
Web3
();
var
assert
=
require
(
'assert'
)
describe
(
"Whisper"
,
function
()
{
before
(
function
()
{
let
provider
=
new
RemixSim
.
Provider
()
web3
.
setProvider
(
provider
)
})
it
(
"should get correct remix simulator version"
,
async
function
()
{
let
version
=
await
web3
.
shh
.
getVersion
()
assert
.
equal
(
version
,
5
)
})
});
remix-tests/package.json
View file @
4e1752dd
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
"signale"
:
"^1.2.1"
,
"signale"
:
"^1.2.1"
,
"solc"
:
"^0.4.24"
,
"solc"
:
"^0.4.24"
,
"standard"
:
"^10.0.3"
,
"standard"
:
"^10.0.3"
,
"web3"
:
"1.0.0-beta.
27
"
,
"web3"
:
"1.0.0-beta.
34
"
,
"winston"
:
"^3.0.0"
"winston"
:
"^3.0.0"
},
},
"devDependencies"
:
{
"devDependencies"
:
{
...
...
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