Move isValidOrderHash to the order_hash_test file

This commit is contained in:
Fabio Berger 2018-05-30 17:55:16 -07:00
parent 4eb58a70bb
commit aa997f1be5
2 changed files with 15 additions and 15 deletions

View File

@ -46,4 +46,19 @@ describe('Order hashing', () => {
expect(() => orderHashUtils.getOrderHashHex(orderWithInvalidtakerFormat)).to.throw(expectedErrorMessage);
});
});
describe('#isValidOrderHash', () => {
it('returns false if the value is not a hex string', () => {
const isValid = orderHashUtils.isValidOrderHash('not a hex');
expect(isValid).to.be.false();
});
it('returns false if the length is wrong', () => {
const isValid = orderHashUtils.isValidOrderHash('0xdeadbeef');
expect(isValid).to.be.false();
});
it('returns true if order hash is correct', () => {
const orderHashLength = 65;
const isValid = orderHashUtils.isValidOrderHash('0x' + Array(orderHashLength).join('0'));
expect(isValid).to.be.true();
});
});
});

View File

@ -111,21 +111,6 @@ describe('Signature utils', () => {
expect(salt.lessThan(twoPow256)).to.be.true();
});
});
describe('#isValidOrderHash', () => {
it('returns false if the value is not a hex string', () => {
const isValid = orderHashUtils.isValidOrderHash('not a hex');
expect(isValid).to.be.false();
});
it('returns false if the length is wrong', () => {
const isValid = orderHashUtils.isValidOrderHash('0xdeadbeef');
expect(isValid).to.be.false();
});
it('returns true if order hash is correct', () => {
const orderHashLength = 65;
const isValid = orderHashUtils.isValidOrderHash('0x' + Array(orderHashLength).join('0'));
expect(isValid).to.be.true();
});
});
describe('#ecSignOrderHashAsync', () => {
let stubs: Sinon.SinonStub[] = [];
let makerAddress: string;