-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Http api 1.0 rc changes #39
Conversation
c747533
to
9a73fc1
Compare
test/connection/test_connection.js
Outdated
|
||
|
||
// TODO: Find out how to mock `request` | ||
test.skip('Request with custom headers', t => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import/export from parent module (index.js)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed this
9a73fc1
to
5c92661
Compare
:( |
Please note that in Connection.js I broke the interface to use camelCased parameters for some methods already. For an example, see this:
|
e1d0f21
to
b883e1f
Compare
Codecov Report
@@ Coverage Diff @@
## master #39 +/- ##
==========================================
+ Coverage 50.53% 68.7% +18.16%
==========================================
Files 21 21
Lines 279 278 -1
==========================================
+ Hits 141 191 +50
+ Misses 138 87 -51
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from the first test in test/connection/test_connection.js
, I'm not sure I understand how the rest of the tests in the same file work.
The file test/constants.js
contains a mixture of constants and functions that returns variable values. I think hard-coding Alice's pubkey (and outputs) is not a good idea since tests run in parallel. In this case we can have problems processing the unspents
—e.g. I want to create a test where I transfer something from Alice to Bob. If Bob's pubkey is constant, tests can influence each others and assertions like:
- unspentst-1(Bob) = unspentst(Bob) + 1
can easily fail.
src/connection/index.js
Outdated
@@ -8,16 +8,15 @@ export default class Connection { | |||
} | |||
|
|||
getApiUrls(endpoints) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endpoints
→ endpoint
(singular)
@@ -128,12 +133,10 @@ export default class Connection { | |||
const timer = setInterval(() => { | |||
this.getStatus(txId) | |||
.then((res) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove extra parenthesis 💅
@@ -128,12 +133,10 @@ export default class Connection { | |||
const timer = setInterval(() => { | |||
this.getStatus(txId) | |||
.then((res) => { | |||
console.log('Fetched transaction status:', res) // eslint-disable-line no-console | |||
if (res.status === 'valid') { | |||
clearInterval(timer) | |||
this.getTransaction(txId) | |||
.then((res_) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove extra parenthesis 💅
test/connection/test_connection.js
Outdated
'transactionsDetail': 'transactions/%(transactionId)s', | ||
'assets': 'assets', | ||
} | ||
Object.keys(endpoints).forEach((endpointName) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove extra parenthesis 💅
test/constants.js
Outdated
// TODO: Find out if ava has something like conftest, if so put this there. | ||
|
||
// NOTE: We cast `Math.random()` to a string, as sometimes Javascript simply | ||
// yields a slightly different float during runtime, lol |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by "slightly different float"?
They check if for given input parameters, the tested function calls the request method correctly.
OK, I can fix this. |
|
test/integration/test_integration.js
Outdated
|
||
const createTx = Transaction.makeCreateTransaction( | ||
asset(), | ||
metaData, | ||
[aliceOutput, aliceOutput], | ||
alice.publicKey | ||
[carolOutput, carolOutput], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
who is Carol?
Why is it connection/index.js rather than just connection.js? |
|
Connection
model to the agreed on HTTP API breaking changes as outlines hereMore info: