build: update typescript version (#1601)

This commit is contained in:
Nathan Nichols
2021-09-13 10:56:19 -07:00
committed by Mayukha Vadari
parent 148cac6f3f
commit 0dc1e08350
11 changed files with 76 additions and 43 deletions

View File

@@ -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)
}
}
})
})

View File

@@ -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)

View File

@@ -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,

View File

@@ -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(

View File

@@ -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)

View File

@@ -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(