Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hive-js
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
hive-js
Commits
8ccaa942
Commit
8ccaa942
authored
6 years ago
by
roadscape
Browse files
Options
Downloads
Patches
Plain Diff
add HF20 claim_account tests
parent
cda6c6f8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/hf20-accounts.test.js
+78
-0
78 additions, 0 deletions
test/hf20-accounts.test.js
with
78 additions
and
0 deletions
test/hf20-accounts.test.js
0 → 100644
+
78
−
0
View file @
8ccaa942
import
Promise
from
'
bluebird
'
;
import
should
from
'
should
'
;
import
steem
from
'
../src
'
;
const
username
=
process
.
env
.
STEEM_USERNAME
||
'
guest123
'
;
const
password
=
process
.
env
.
STEEM_PASSWORD
;
const
activeWif
=
steem
.
auth
.
toWif
(
username
,
password
,
'
active
'
);
describe
(
'
steem.hf20-accounts:
'
,
()
=>
{
it
(
'
has generated methods
'
,
()
=>
{
should
.
exist
(
steem
.
broadcast
.
claimAccount
);
should
.
exist
(
steem
.
broadcast
.
createClaimedAccount
);
});
it
(
'
has promise methods
'
,
()
=>
{
should
.
exist
(
steem
.
broadcast
.
claimAccountAsync
);
should
.
exist
(
steem
.
broadcast
.
createClaimedAccountAsync
);
});
describe
(
'
claimAccount
'
,
()
=>
{
it
(
'
signs and verifies auth
'
,
function
(
done
)
{
let
tx
=
{
'
operations
'
:
[[
'
claim_account
'
,
{
'
creator
'
:
username
,
'
fee
'
:
'
0.000 TESTS
'
}]]
}
steem
.
api
.
callAsync
(
'
condenser_api.get_version
'
,
[]).
then
((
result
)
=>
{
result
.
should
.
have
.
property
(
'
blockchain_version
'
);
if
(
result
[
'
blockchain_version
'
]
<
'
0.21.0
'
)
return
done
();
/* SKIP */
result
.
should
.
have
.
property
(
'
blockchain_version
'
,
'
0.21.0
'
)
steem
.
broadcast
.
_prepareTransaction
(
tx
).
then
(
function
(
tx
){
tx
=
steem
.
auth
.
signTransaction
(
tx
,
[
activeWif
]);
steem
.
api
.
verifyAuthorityAsync
(
tx
).
then
(
(
result
)
=>
{
result
.
should
.
equal
(
true
);
done
();},
(
err
)
=>
{
done
(
err
);}
);
});
});
});
it
(
'
claims and creates account
'
,
function
(
done
)
{
this
.
skip
();
// (!) need test account with enough RC
steem
.
api
.
callAsync
(
'
condenser_api.get_version
'
,
[]).
then
((
result
)
=>
{
result
.
should
.
have
.
property
(
'
blockchain_version
'
);
if
(
result
[
'
blockchain_version
'
]
<
'
0.21.0
'
)
return
done
();
/* SKIP */
result
.
should
.
have
.
property
(
'
blockchain_version
'
,
'
0.21.0
'
)
steem
.
broadcast
.
claimAccountAsync
(
activeWif
,
username
,
'
0.000 TESTS
'
,
[]).
then
((
result
)
=>
{
let
newAccountName
=
username
+
'
-
'
+
Math
.
floor
(
Math
.
random
()
*
10000
);
let
keys
=
steem
.
auth
.
generateKeys
(
username
,
password
,
[
'
posting
'
,
'
active
'
,
'
owner
'
,
'
memo
'
]);
steem
.
broadcast
.
createClaimedAccountAsync
(
activeWif
,
username
,
newAccountName
,
keys
[
'
owner
'
],
keys
[
'
active
'
],
keys
[
'
posting
'
],
keys
[
'
memo
'
],
{},
[]
).
then
((
result
)
=>
{
should
.
exist
(
result
);
done
();
},
(
err
)
=>
{
done
(
err
)});
},
(
err
)
=>
{
done
(
err
)});
});
});
});
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment