|
|
@ -32,7 +32,7 @@ describe('add-recipient utils', function () { |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
it('should return null if to is falsy and hexData is truthy', function () { |
|
|
|
it('should return null if to is falsy and hexData is truthy', function () { |
|
|
|
assert.deepEqual(getToErrorObject(null, undefined, true), { |
|
|
|
assert.deepEqual(getToErrorObject(null, true), { |
|
|
|
to: null, |
|
|
|
to: null, |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
@ -49,31 +49,25 @@ describe('add-recipient utils', function () { |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
it('should return the passed error if to is truthy but invalid if to is truthy and valid', function () { |
|
|
|
|
|
|
|
assert.deepEqual(getToErrorObject('invalid #$ 345878', 'someExplicitError'), { |
|
|
|
|
|
|
|
to: 'someExplicitError', |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it('should return null if to is truthy but part of state tokens', function () { |
|
|
|
it('should return null if to is truthy but part of state tokens', function () { |
|
|
|
assert.deepEqual(getToErrorObject('0xabc123', undefined, false, [{ 'address': '0xabc123' }], { 'address': '0xabc123' }), { |
|
|
|
assert.deepEqual(getToErrorObject('0xabc123', false, [{ 'address': '0xabc123' }], { 'address': '0xabc123' }), { |
|
|
|
to: null, |
|
|
|
to: null, |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
it('should null if to is truthy part of tokens but selectedToken falsy', function () { |
|
|
|
it('should null if to is truthy part of tokens but selectedToken falsy', function () { |
|
|
|
assert.deepEqual(getToErrorObject('0xabc123', undefined, false, [{ 'address': '0xabc123' }]), { |
|
|
|
assert.deepEqual(getToErrorObject('0xabc123', false, [{ 'address': '0xabc123' }]), { |
|
|
|
to: null, |
|
|
|
to: null, |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
it('should return null if to is truthy but part of contract metadata', function () { |
|
|
|
it('should return null if to is truthy but part of contract metadata', function () { |
|
|
|
assert.deepEqual(getToErrorObject('0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359', undefined, false, [{ 'address': '0xabc123' }], { 'address': '0xabc123' }), { |
|
|
|
assert.deepEqual(getToErrorObject('0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359', false, [{ 'address': '0xabc123' }], { 'address': '0xabc123' }), { |
|
|
|
to: null, |
|
|
|
to: null, |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
it('should null if to is truthy part of contract metadata but selectedToken falsy', function () { |
|
|
|
it('should null if to is truthy part of contract metadata but selectedToken falsy', function () { |
|
|
|
assert.deepEqual(getToErrorObject('0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359', undefined, false, [{ 'address': '0xabc123' }], { 'address': '0xabc123' }), { |
|
|
|
assert.deepEqual(getToErrorObject('0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359', false, [{ 'address': '0xabc123' }], { 'address': '0xabc123' }), { |
|
|
|
to: null, |
|
|
|
to: null, |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
@ -81,24 +75,24 @@ describe('add-recipient utils', function () { |
|
|
|
|
|
|
|
|
|
|
|
describe('getToWarningObject()', function () { |
|
|
|
describe('getToWarningObject()', function () { |
|
|
|
it('should return a known address recipient if to is truthy but part of state tokens', function () { |
|
|
|
it('should return a known address recipient if to is truthy but part of state tokens', function () { |
|
|
|
assert.deepEqual(getToWarningObject('0xabc123', undefined, [{ 'address': '0xabc123' }], { 'address': '0xabc123' }), { |
|
|
|
assert.deepEqual(getToWarningObject('0xabc123', [{ 'address': '0xabc123' }], { 'address': '0xabc123' }), { |
|
|
|
to: KNOWN_RECIPIENT_ADDRESS_ERROR, |
|
|
|
to: KNOWN_RECIPIENT_ADDRESS_ERROR, |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
it('should null if to is truthy part of tokens but selectedToken falsy', function () { |
|
|
|
it('should null if to is truthy part of tokens but selectedToken falsy', function () { |
|
|
|
assert.deepEqual(getToWarningObject('0xabc123', undefined, [{ 'address': '0xabc123' }]), { |
|
|
|
assert.deepEqual(getToWarningObject('0xabc123', [{ 'address': '0xabc123' }]), { |
|
|
|
to: null, |
|
|
|
to: null, |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
it('should return a known address recipient if to is truthy but part of contract metadata', function () { |
|
|
|
it('should return a known address recipient if to is truthy but part of contract metadata', function () { |
|
|
|
assert.deepEqual(getToWarningObject('0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359', undefined, [{ 'address': '0xabc123' }], { 'address': '0xabc123' }), { |
|
|
|
assert.deepEqual(getToWarningObject('0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359', [{ 'address': '0xabc123' }], { 'address': '0xabc123' }), { |
|
|
|
to: KNOWN_RECIPIENT_ADDRESS_ERROR, |
|
|
|
to: KNOWN_RECIPIENT_ADDRESS_ERROR, |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
it('should null if to is truthy part of contract metadata but selectedToken falsy', function () { |
|
|
|
it('should null if to is truthy part of contract metadata but selectedToken falsy', function () { |
|
|
|
assert.deepEqual(getToWarningObject('0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359', undefined, [{ 'address': '0xabc123' }], { 'address': '0xabc123' }), { |
|
|
|
assert.deepEqual(getToWarningObject('0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359', [{ 'address': '0xabc123' }], { 'address': '0xabc123' }), { |
|
|
|
to: KNOWN_RECIPIENT_ADDRESS_ERROR, |
|
|
|
to: KNOWN_RECIPIENT_ADDRESS_ERROR, |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|