Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #804 from LiskHQ/456-unit-test-for-signature-trans…
Browse files Browse the repository at this point in the history
…action

Unit test for signature transaction - Subtask #456 - Closes #827
  • Loading branch information
Isabella Dell authored Oct 6, 2017
2 parents fd2d7cd + ed46587 commit 3732284
Show file tree
Hide file tree
Showing 4 changed files with 584 additions and 8 deletions.
2 changes: 1 addition & 1 deletion logic/signature.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ Signature.prototype.objectNormalize = function (trs) {
var report = library.schema.validate(trs.asset.signature, Signature.prototype.schema);

if (!report) {
throw 'Failed to validate signature schema: ' + this.scope.schema.getLastErrors().map(function (err) {
throw 'Failed to validate signature schema: ' + library.schema.getLastErrors().map(function (err) {
return err.message;
}).join(', ');
}
Expand Down
21 changes: 14 additions & 7 deletions test/common/typesRepresentatives.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,7 @@ var others = [
}
];

var strings = [
{
input: '',
description: 'empty string',
expectation: 'string'
},
var nonEmptyStrings = [
{
input: '0',
description: '0 as string',
Expand Down Expand Up @@ -147,6 +142,16 @@ var strings = [
}
];

var emptyString = [
{
input: '',
description: 'empty string',
expectation: 'string'
}
];

var strings = nonEmptyStrings.concat(emptyString);

var allTypes = arrays
.concat(booleans)
.concat(positiveIntegers)
Expand All @@ -167,5 +172,7 @@ module.exports = {
negativeNumbers: negativeNumbers,
objects: objects,
others: others,
strings: strings
strings: strings,
nonEmptyStrings: nonEmptyStrings,
emptyString: emptyString
};
1 change: 1 addition & 0 deletions test/unit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ require('./logic/peers');
require('./logic/multisignature');
require('./logic/transaction');
require('./logic/transfer');
require('./logic/signature.js');
require('./logic/vote');

require('./modules/blocks/process');
Expand Down
Loading

0 comments on commit 3732284

Please sign in to comment.