forked from fibercrypto/libjs-skycoin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[skyapi] refs fibercrypto#12 - Add test for the node skycoin api
- Loading branch information
cbermudez97
committed
Mar 29, 2019
1 parent
04764c4
commit 11ed2d1
Showing
3 changed files
with
30 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,32 @@ | ||
"use strict"; | ||
|
||
// Set BASEPATH | ||
const localBasePath = 'http://127.0.0.1:6420'; | ||
const developBasePath = 'https://staging.node.skycoin.net'; | ||
const prodBasePath = 'https://node.skycoin.net'; | ||
|
||
// AXIOS | ||
const testAxios = function (basePath) { | ||
const skyapi_axios = require("libsky-axios"); //Load the Axios API client | ||
let api_axios_config = new skyapi_axios.Configuration(); //Create a default configuration class | ||
const skyapi_axios = require("libsky-axios"); // Load the Axios API client | ||
let api_axios_config = new skyapi_axios.Configuration(); // Create a default configuration class | ||
let api_axios = new skyapi_axios.DefaultApi(api_axios_config, basePath); // Create the API instance | ||
// Make a petition to version of skycoin node | ||
// Make a petition of the version to the skycoin node | ||
api_axios.version().then(result => { | ||
console.log(`Response from skyapi_axios\n${basePath}: ${JSON.stringify(result.data)}`); //Print the response data field | ||
console.log(`Response from skycoin node in ${basePath} using axios client: ${JSON.stringify(result.data)}`); //Print the response data field | ||
}); | ||
}; | ||
|
||
// NODE | ||
const testNode = function (basePath) { | ||
const skyapi_node = require("libsky-node"); // Load the Node API client | ||
let api_node = new skyapi_node.DefaultApi(basePath); // Create the API instance | ||
// Make a petition of the version to the skycoin node | ||
api_node.version().then(result => { | ||
console.log(`Response from skycoin node in ${basePath} using node client: ${JSON.stringify(result.body)}`); //Print the response body field | ||
}); | ||
}; | ||
|
||
// testAxios(localBasePath); | ||
testAxios(developBasePath); | ||
testAxios(prodBasePath); | ||
|
||
testNode(developBasePath); | ||
testNode(prodBasePath); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters