Merge pull request #786 from ripple/escrow-execution-ValidationError

escrow-execution - Add reference to ValidationError
This commit is contained in:
Elliot Lee
2017-11-10 14:57:38 -08:00
committed by GitHub
5 changed files with 28 additions and 1 deletions

View File

@@ -3,6 +3,7 @@
const _ = require('lodash')
const utils = require('./utils')
const validate = utils.common.validate
const ValidationError = utils.common.errors.ValidationError
import type {Instructions, Prepare} from './types.js'
import type {Memo} from '../common/types.js'

View File

@@ -302,6 +302,20 @@ describe('RippleAPI', function() {
'prepare'));
});
it('prepareEscrowExecution - no condition', function() {
assert.throws(() => {
this.api.prepareEscrowExecution(address,
requests.prepareEscrowExecution.noCondition, instructions);
}, /"condition" and "fulfillment" fields on EscrowFinish must only be specified together./);
});
it('prepareEscrowExecution - no fulfillment', function() {
assert.throws(() => {
this.api.prepareEscrowExecution(address,
requests.prepareEscrowExecution.noFulfillment, instructions);
}, /"condition" and "fulfillment" fields on EscrowFinish must only be specified together./);
});
it('prepareEscrowCancellation', function() {
return this.api.prepareEscrowCancellation(
address,

View File

@@ -30,7 +30,9 @@ module.exports = {
},
prepareEscrowExecution: {
normal: require('./prepare-escrow-execution'),
simple: require('./prepare-escrow-execution-simple')
simple: require('./prepare-escrow-execution-simple'),
noCondition: require('./prepare-escrow-execution-no-condition'),
noFulfillment: require('./prepare-escrow-execution-no-fulfillment')
},
prepareEscrowCancellation: {
normal: require('./prepare-escrow-cancellation'),

View File

@@ -0,0 +1,5 @@
{
"owner": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"escrowSequence": 1234,
"fulfillment": "A0028000"
}

View File

@@ -0,0 +1,5 @@
{
"owner": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"escrowSequence": 1234,
"condition": "A0258020E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855810100"
}