Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Commit

Permalink
add test for loading PayId
Browse files Browse the repository at this point in the history
  • Loading branch information
nhartner committed Aug 19, 2020
1 parent 487fb91 commit d1f0987
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/unit/loadPayId.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import 'mocha'
import { assert } from 'chai'

import { loadPayId } from '../../src/commands/Command'

describe('loadPayId()', function (): void {
it('Returns a PaymentInformation given a valid PayID', async function (): Promise<
void
> {
const info = await loadPayId('nhartner$xpring.money')
assert.equal(info.payId, 'nhartner$xpring.money')
assert.isTrue(info.addresses.length > 0)
})

it('Gives error when PayID returns 404', async function (): Promise<void> {
try {
await loadPayId('bogusaccount$xpring.money')
assert.fail('expected error')
} catch (error) {
assert.deepEqual(
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- Error is untyped
error.message,
'Received HTTP status 404 on https://xpring.money/bogusaccount',
)
}
})
})

0 comments on commit d1f0987

Please sign in to comment.