mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-19 19:55:51 +00:00
build: update typescript version (#1601)
This commit is contained in:
committed by
Mayukha Vadari
parent
148cac6f3f
commit
0dc1e08350
@@ -1,6 +1,7 @@
|
||||
import { assert } from 'chai'
|
||||
import { assert, expect } from 'chai'
|
||||
import binary from 'ripple-binary-codec'
|
||||
|
||||
import { ValidationError } from '../../src/common/errors'
|
||||
import requests from '../fixtures/requests'
|
||||
import responses from '../fixtures/responses'
|
||||
import { setupClient, teardownClient } from '../setupClient'
|
||||
@@ -347,22 +348,29 @@ describe('client.sign', function () {
|
||||
Fee: '12',
|
||||
}
|
||||
const secret = 'shsWGZcmZz6YsWWmcnpfr6fLTdtFV'
|
||||
|
||||
try {
|
||||
this.client.sign(JSON.stringify(offerCreate), secret)
|
||||
return await Promise.reject(
|
||||
new Error('this.client.sign should have thrown'),
|
||||
)
|
||||
} catch (error) {
|
||||
assert.equal(error.name, 'ValidationError')
|
||||
assert.equal(
|
||||
error.message,
|
||||
'Serialized transaction does not match original txJSON. See `error.data`',
|
||||
)
|
||||
assert.deepEqual(error.data.diff, {
|
||||
TakerGets: {
|
||||
value: '3.14',
|
||||
},
|
||||
})
|
||||
if (error instanceof ValidationError) {
|
||||
assert.equal(error.name, 'ValidationError')
|
||||
assert.equal(
|
||||
error.message,
|
||||
'Serialized transaction does not match original txJSON. See `error.data`',
|
||||
)
|
||||
expect(error.data).to.deep.include({
|
||||
diff: {
|
||||
TakerGets: {
|
||||
value: '3.14',
|
||||
},
|
||||
},
|
||||
})
|
||||
} else {
|
||||
assert(false)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { assert } from 'chai'
|
||||
|
||||
import rippled from '../fixtures/rippled'
|
||||
import { setupClient, teardownClient } from '../setupClient'
|
||||
import {setupClient, teardownClient} from '../setupClient'
|
||||
|
||||
|
||||
describe('Subscription', function () {
|
||||
beforeEach(setupClient)
|
||||
|
||||
@@ -262,6 +262,10 @@ describe('Connection', function () {
|
||||
try {
|
||||
await this.client.connect()
|
||||
} catch (error) {
|
||||
if (!(error instanceof Error)) {
|
||||
throw error
|
||||
}
|
||||
|
||||
assert.instanceOf(error, DisconnectedError)
|
||||
assert.strictEqual(
|
||||
error.message,
|
||||
|
||||
@@ -78,9 +78,12 @@ export default function createMockRippled(port: number): MockedWebSocketServer {
|
||||
)
|
||||
}
|
||||
} catch (err) {
|
||||
if (!(err instanceof Error)) {
|
||||
throw err
|
||||
}
|
||||
|
||||
if (!mock.suppressOutput) {
|
||||
// eslint-disable-next-line no-console, @typescript-eslint/restrict-template-expressions -- Error
|
||||
console.error(`Error: ${err.message}`)
|
||||
console.error(err.message)
|
||||
}
|
||||
if (request != null) {
|
||||
conn.send(
|
||||
|
||||
@@ -66,6 +66,10 @@ export async function assertRejects(
|
||||
await promise
|
||||
assert(false, 'Expected an error to be thrown')
|
||||
} catch (error) {
|
||||
if (!(error instanceof Error)) {
|
||||
throw error
|
||||
}
|
||||
|
||||
assert(error instanceof instanceOf, error.message)
|
||||
if (typeof message === 'string') {
|
||||
assert.strictEqual(error.message, message)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { assert } from 'chai'
|
||||
|
||||
import { ValidationError } from '../../src/common/errors'
|
||||
import { ValidationError, XrplError } from '../../src/common/errors'
|
||||
import { computeLedgerHash } from '../../src/utils'
|
||||
import requests from '../fixtures/requests'
|
||||
import responses from '../fixtures/responses'
|
||||
@@ -27,6 +27,10 @@ describe('computeLedgerHash', function () {
|
||||
try {
|
||||
hash = computeLedgerHash(ledger, { computeTreeHashes: true })
|
||||
} catch (error) {
|
||||
if (!(error instanceof XrplError)) {
|
||||
throw error
|
||||
}
|
||||
|
||||
assert(error instanceof ValidationError)
|
||||
if (error instanceof ValidationError) {
|
||||
assert.strictEqual(
|
||||
|
||||
Reference in New Issue
Block a user