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

Commit d1f0987

Browse files
committed
add test for loading PayId
1 parent 487fb91 commit d1f0987

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/unit/loadPayId.test.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import 'mocha'
2+
import { assert } from 'chai'
3+
4+
import { loadPayId } from '../../src/commands/Command'
5+
6+
describe('loadPayId()', function (): void {
7+
it('Returns a PaymentInformation given a valid PayID', async function (): Promise<
8+
void
9+
> {
10+
const info = await loadPayId('nhartner$xpring.money')
11+
assert.equal(info.payId, 'nhartner$xpring.money')
12+
assert.isTrue(info.addresses.length > 0)
13+
})
14+
15+
it('Gives error when PayID returns 404', async function (): Promise<void> {
16+
try {
17+
await loadPayId('bogusaccount$xpring.money')
18+
assert.fail('expected error')
19+
} catch (error) {
20+
assert.deepEqual(
21+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- Error is untyped
22+
error.message,
23+
'Received HTTP status 404 on https://xpring.money/bogusaccount',
24+
)
25+
}
26+
})
27+
})

0 commit comments

Comments
 (0)