mirror of
https://github.com/Permissionless-Software-Foundation/bch-js.git
synced 2026-09-21 16:51:59 -07:00
fix(rate limits): Updated e2e tests for post-fork servers
This commit is contained in:
@@ -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")
|
||||||
|
|||||||
@@ -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}`)
|
||||||
|
|||||||
Reference in New Issue
Block a user