fix(rate limits): Updated e2e tests for post-fork servers

This commit is contained in:
Chris Troutner
2020-11-11 18:39:57 -08:00
parent e070409a95
commit 4c020240e1
4 changed files with 14 additions and 10 deletions
@@ -15,7 +15,8 @@
const assert = require("chai").assert const assert = require("chai").assert
// const RESTURL = `https://abc.fullstack.cash/v3/` // const RESTURL = `https://abc.fullstack.cash/v3/`
const RESTURL = `http://localhost:3000/v3/` const RESTURL = `https://bchn.fullstack.cash/v3/`
// const RESTURL = `http://localhost:3000/v3/`
const BCHJS = require("../../../src/bch-js") const BCHJS = require("../../../src/bch-js")
const bchjs = new BCHJS({ restURL: RESTURL }) const bchjs = new BCHJS({ restURL: RESTURL })
@@ -29,7 +30,7 @@ describe("#anonymous rate limits", () => {
it("should allow an anonymous call to an indexer", async () => { it("should allow an anonymous call to an indexer", async () => {
const addr = "bitcoincash:qrdka2205f4hyukutc2g0s6lykperc8nsu5u2ddpqf" const addr = "bitcoincash:qrdka2205f4hyukutc2g0s6lykperc8nsu5u2ddpqf"
const result = await bchjs.Blockbook.balance(addr) const result = await bchjs.Electrumx.balance(addr)
// console.log(`result: ${JSON.stringify(result, null, 2)}`) // console.log(`result: ${JSON.stringify(result, null, 2)}`)
assert.property(result, "balance") assert.property(result, "balance")
@@ -13,12 +13,13 @@ const PRO_PASS = "testpassword"
const BCHJS = require("../../../src/bch-js") const BCHJS = require("../../../src/bch-js")
const bchjs = new BCHJS({ const bchjs = new BCHJS({
// restURL: `https://api.fullstack.cash/v3/`, // restURL: `https://bchn.fullstack.cash/v3/`,
restURL: `http://localhost:3000/v3/`, restURL: `https://abc.fullstack.cash/v3/`,
// restURL: `http://localhost:3000/v3/`,
authPass: PRO_PASS authPass: PRO_PASS
}) })
describe("#full node rate limits", () => { describe("#Basic Authentication rate limits", () => {
it("should allow more than 20 RPM to full node", async () => { it("should allow more than 20 RPM to full node", async () => {
for (let i = 0; i < 22; i++) { for (let i = 0; i < 22; i++) {
const result = await bchjs.Control.getNetworkInfo() const result = await bchjs.Control.getNetworkInfo()
@@ -18,7 +18,8 @@ const JWT_TOKEN =
const BCHJS = require("../../../src/bch-js") const BCHJS = require("../../../src/bch-js")
const bchjs = new BCHJS({ const bchjs = new BCHJS({
restURL: `https://api.fullstack.cash/v3/`, // restURL: `https://bchn.fullstack.cash/v3/`,
restURL: `https:/abc.fullstack.cash/v3/`,
// restURL: `http://localhost:3000/v3/`, // restURL: `http://localhost:3000/v3/`,
apiToken: JWT_TOKEN apiToken: JWT_TOKEN
}) })
@@ -26,7 +27,7 @@ const bchjs = new BCHJS({
describe("#full node rate limits", () => { describe("#full node rate limits", () => {
it("should allow an free call to an indexer", async () => { it("should allow an free call to an indexer", async () => {
const addr = "bitcoincash:qrdka2205f4hyukutc2g0s6lykperc8nsu5u2ddpqf" const addr = "bitcoincash:qrdka2205f4hyukutc2g0s6lykperc8nsu5u2ddpqf"
const result = await bchjs.Blockbook.balance(addr) const result = await bchjs.Electrumx.balance(addr)
// console.log(`result: ${JSON.stringify(result, null, 2)}`) // console.log(`result: ${JSON.stringify(result, null, 2)}`)
assert.property(result, "balance") assert.property(result, "balance")
+4 -3
View File
@@ -14,12 +14,13 @@ const JWT_TOKEN =
const BCHJS = require("../../../src/bch-js") const BCHJS = require("../../../src/bch-js")
const bchjs = new BCHJS({ const bchjs = new BCHJS({
restURL: `https://api.fullstack.cash/v3/`, // restURL: `https://bchn.fullstack.cash/v3/`,
restURL: `https://abc.fullstack.cash/v3/`,
// restURL: `http://localhost:3000/v3/`, // restURL: `http://localhost:3000/v3/`,
apiToken: JWT_TOKEN apiToken: JWT_TOKEN
}) })
describe("#full node rate limits", () => { describe("#Indexer rate limits", () => {
it("should allow more than 20 RPM to full node", async () => { it("should allow more than 20 RPM to full node", async () => {
for (let i = 0; i < 22; i++) { for (let i = 0; i < 22; i++) {
const result = await bchjs.Control.getNetworkInfo() const result = await bchjs.Control.getNetworkInfo()
@@ -40,7 +41,7 @@ describe("#full node rate limits", () => {
const addr = "bitcoincash:qrdka2205f4hyukutc2g0s6lykperc8nsu5u2ddpqf" const addr = "bitcoincash:qrdka2205f4hyukutc2g0s6lykperc8nsu5u2ddpqf"
for (let i = 0; i < 22; i++) { for (let i = 0; i < 22; i++) {
const result = await bchjs.Blockbook.balance(addr) const result = await bchjs.Electrumx.balance(addr)
if (i === 5) { if (i === 5) {
// console.log(`validating 5th call: ${i}`) // console.log(`validating 5th call: ${i}`)