Files
xahau.js/test/wallet-generation-test.ts
Florent 69113de552 Generate faucet wallet Testnet and Devnet (#1497)
* generate faucet wallet

* updated comments

* added example in documentation

* updated documentation

* Added xprl.org link in docs

* updated code snippet

* Made changes from comments

* new changes from comments

* yarn.lock

* removed axios and use https.request

* updated webpack to include http and https fallback

* fixed files formatting

* small fixes

* Fix typo for Testnet

Co-authored-by: Elliot Lee <github.public@intelliot.com>

Co-authored-by: Elliot Lee <github.public@intelliot.com>
2021-08-10 15:20:43 +08:00

36 lines
1.1 KiB
TypeScript

import assert from 'assert-diff'
import setupAPI from './setup-api'
import {getFaucetUrl, FaucetNetwork} from '../src/wallet/wallet-generation'
describe('Get Faucet URL', function () {
beforeEach(setupAPI.setup)
afterEach(setupAPI.teardown)
it('returns the Devnet URL', function () {
const expectedFaucet = FaucetNetwork.Devnet
this.api.connection._url = FaucetNetwork.Devnet
assert.strictEqual(getFaucetUrl(this.api), expectedFaucet)
})
it('returns the Testnet URL', function () {
const expectedFaucet = FaucetNetwork.Testnet
this.api.connection._url = FaucetNetwork.Testnet
assert.strictEqual(getFaucetUrl(this.api), expectedFaucet)
})
it('returns the Testnet URL with the XRPL Labs server', function () {
const expectedFaucet = FaucetNetwork.Testnet
this.api.connection._url = 'wss://testnet.xrpl-labs.com'
assert.strictEqual(getFaucetUrl(this.api), expectedFaucet)
})
it('returns undefined if not a Testnet or Devnet server URL', function () {
// Info: setupAPI.setup creates a connection to 'localhost'
assert.strictEqual(getFaucetUrl(this.api), undefined)
})
})