Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('without should fail', () => {
transaction = lisk.transfer.createOutTransfer(
randomUtil.guestbookDapp.id,
randomUtil.transaction().id,
accountFixtures.genesis.address,
Date.now(),
account.passphrase
);
delete transaction.asset.outTransfer.dappId;
return sendTransactionPromise(
transaction,
errorCodes.PROCESSING_ERROR
).then(res => {
expect(res.body.message).to.be.equal(
'Invalid transaction body - Failed to validate outTransfer schema: Missing required property: dappId'
);
badTransactions.push(transaction);
it('using unknown dapp id should fail', () => {
var unknownDappId = '1';
transaction = lisk.transfer.createOutTransfer(
unknownDappId,
randomUtil.transaction().id,
accountFixtures.genesis.address,
1,
account.passphrase
);
return sendTransactionPromise(
transaction,
errorCodes.PROCESSING_ERROR
).then(res => {
expect(res.body.message).to.be.equal(
`Application not found: ${unknownDappId}`
);
badTransactions.push(transaction);
});
it('without should fail', () => {
transaction = lisk.transfer.createInTransfer(
randomUtil.guestbookDapp.id,
Date.now(),
accountFixtures.genesis.passphrase
);
delete transaction.asset.inTransfer.dappId;
return sendTransactionPromise(
transaction,
errorCodes.PROCESSING_ERROR
).then(res => {
expect(res.body.message).to.be.equal(
'Invalid transaction body - Failed to validate inTransfer schema: Missing required property: dappId'
);
badTransactions.push(transaction);
});
});
it('with number should fail', () => {
transaction = lisk.transfer.createInTransfer(
randomUtil.guestbookDapp.id,
Date.now(),
accountFixtures.genesis.passphrase
);
transaction.asset.inTransfer.dappId = 1.2;
return sendTransactionPromise(
transaction,
errorCodes.PROCESSING_ERROR
).then(res => {
expect(res.body.message).to.be.equal(
"Invalid transaction body - Failed to validate inTransfer schema: Expected type string but found type number, Object didn't pass validation for format id: 1.2"
);
badTransactions.push(transaction);
});
});