This repository has been archived by the owner on Mar 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
) | ||
} | ||
}) | ||
}) |