Skip to content

Commit

Permalink
code suggestions from rabbit AI
Browse files Browse the repository at this point in the history
  • Loading branch information
ckeshava committed Jan 8, 2025
1 parent 76e5d09 commit 0ad5503
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ describe('PermissionedDomainSet', function () {
DomainID: pd.index
}

console.log(pd)

await testTransaction(testContext.client, tx_pd_delete, testContext.wallet)
},
TIMEOUT,
Expand Down
32 changes: 24 additions & 8 deletions packages/xrpl/test/models/permissionedDomainSet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ import { validate, ValidationError } from '../../src'
*/
describe('PermissionedDomainSet', function () {
let tx

beforeEach(function () {

const sampleCredential: Credential = {
Credential: {
CredentialType: stringToHex('Passport'),
Issuer: 'rfmDuhDyLGgx94qiwf3YF8BUV5j6KSvE8'
}
const sampleCredential: Credential = {
Credential: {
CredentialType: stringToHex('Passport'),
Issuer: 'rfmDuhDyLGgx94qiwf3YF8BUV5j6KSvE8'
}
}

beforeEach(function () {
tx = {
TransactionType: 'PermissionedDomainSet',
Account: 'rfmDuhDyLGgx94qiwf3YF8BUV5j6KSvE8',
Expand All @@ -48,4 +46,22 @@ describe('PermissionedDomainSet', function () {
assert.throws(() => validatePermissionedDomainSet(tx), ValidationError, errorMessage)
assert.throws(() => validate(tx), ValidationError, errorMessage)
})

it('throws when AcceptedCredentials exceeds maximum length', function () {
tx.AcceptedCredentials = Array(11).fill(sampleCredential)
assert.throws(
() => validatePermissionedDomainSet(tx),
ValidationError,
'PermissionedDomainSet: AcceptedCredentials must have at most 10 Credential objects'
)
})

it('throws when AcceptedCredentials is empty', function () {
tx.AcceptedCredentials = []
assert.throws(
() => validatePermissionedDomainSet(tx),
ValidationError,
'PermissionedDomainSet: AcceptedCredentials must have at least one Credential object'
)
})
})

0 comments on commit 0ad5503

Please sign in to comment.