Typos in LibBytes tests

This commit is contained in:
Greg Hysen 2018-08-29 13:17:13 -07:00
parent 5f1c9cfee5
commit aa833ef074

View File

@ -115,7 +115,7 @@ describe('LibBytes', () => {
expect(newBytes).to.equal(expectedNewBytes); expect(newBytes).to.equal(expectedNewBytes);
expect(poppedByte).to.equal(expectedPoppedByte); expect(poppedByte).to.equal(expectedPoppedByte);
}); });
it('should pop the last byte from the input and return it when array is exactly one', async () => { it('should pop the last byte from the input and return it when array is exactly 1 byte', async () => {
const [newBytes, poppedByte] = await libBytes.publicPopLastByte.callAsync(testByte); const [newBytes, poppedByte] = await libBytes.publicPopLastByte.callAsync(testByte);
const expectedNewBytes = '0x'; const expectedNewBytes = '0x';
expect(newBytes).to.equal(expectedNewBytes); expect(newBytes).to.equal(expectedNewBytes);
@ -130,7 +130,7 @@ describe('LibBytes', () => {
RevertReason.LibBytesGreaterOrEqualTo20LengthRequired, RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
); );
}); });
it('should pop the last 20 bytes from the input and return it when array holds more than one byte', async () => { it('should pop the last 20 bytes from the input and return it when array holds more than 20 bytes', async () => {
const [newBytes, poppedAddress] = await libBytes.publicPopLast20Bytes.callAsync(byteArrayLongerThan32Bytes); const [newBytes, poppedAddress] = await libBytes.publicPopLast20Bytes.callAsync(byteArrayLongerThan32Bytes);
const expectedNewBytes = byteArrayLongerThan32Bytes.slice(0, -40); const expectedNewBytes = byteArrayLongerThan32Bytes.slice(0, -40);
const expectedPoppedAddress = `0x${byteArrayLongerThan32Bytes.slice(-40)}`; const expectedPoppedAddress = `0x${byteArrayLongerThan32Bytes.slice(-40)}`;
@ -318,7 +318,7 @@ describe('LibBytes', () => {
const bytes32 = await libBytes.publicReadBytes32.callAsync(testBytes32, testBytes32Offset); const bytes32 = await libBytes.publicReadBytes32.callAsync(testBytes32, testBytes32Offset);
return expect(bytes32).to.be.equal(testBytes32); return expect(bytes32).to.be.equal(testBytes32);
}); });
it('should successfully read bytes32 when it is offset in the array)', async () => { it('should successfully read bytes32 when it is offset in the array', async () => {
const bytes32ByteArrayBuffer = ethUtil.toBuffer(testBytes32); const bytes32ByteArrayBuffer = ethUtil.toBuffer(testBytes32);
const prefixByteArrayBuffer = ethUtil.toBuffer('0xabcdef'); const prefixByteArrayBuffer = ethUtil.toBuffer('0xabcdef');
const combinedByteArrayBuffer = Buffer.concat([prefixByteArrayBuffer, bytes32ByteArrayBuffer]); const combinedByteArrayBuffer = Buffer.concat([prefixByteArrayBuffer, bytes32ByteArrayBuffer]);
@ -493,7 +493,7 @@ describe('LibBytes', () => {
const bytes4 = await libBytes.publicReadBytes4.callAsync(testBytes4, testBytes4Offset); const bytes4 = await libBytes.publicReadBytes4.callAsync(testBytes4, testBytes4Offset);
return expect(bytes4).to.be.equal(testBytes4); return expect(bytes4).to.be.equal(testBytes4);
}); });
it('should successfully read bytes4 when it is offset in the array)', async () => { it('should successfully read bytes4 when it is offset in the array', async () => {
const bytes4ByteArrayBuffer = ethUtil.toBuffer(testBytes4); const bytes4ByteArrayBuffer = ethUtil.toBuffer(testBytes4);
const prefixByteArrayBuffer = ethUtil.toBuffer('0xabcdef'); const prefixByteArrayBuffer = ethUtil.toBuffer('0xabcdef');
const combinedByteArrayBuffer = Buffer.concat([prefixByteArrayBuffer, bytes4ByteArrayBuffer]); const combinedByteArrayBuffer = Buffer.concat([prefixByteArrayBuffer, bytes4ByteArrayBuffer]);
@ -583,7 +583,7 @@ describe('LibBytes', () => {
}); });
describe('writeBytesWithLength', () => { describe('writeBytesWithLength', () => {
it('should successfully write short, nested array of bytes when it takes up the whole array)', async () => { it('should successfully write short, nested array of bytes when it takes up the whole array', async () => {
const testBytesOffset = new BigNumber(0); const testBytesOffset = new BigNumber(0);
const emptyByteArray = ethUtil.bufferToHex(new Buffer(shortTestBytesAsBuffer.byteLength)); const emptyByteArray = ethUtil.bufferToHex(new Buffer(shortTestBytesAsBuffer.byteLength));
const bytesWritten = await libBytes.publicWriteBytesWithLength.callAsync( const bytesWritten = await libBytes.publicWriteBytesWithLength.callAsync(
@ -692,7 +692,7 @@ describe('LibBytes', () => {
RevertReason.LibBytesGreaterOrEqualToNestedBytesLengthRequired, RevertReason.LibBytesGreaterOrEqualToNestedBytesLengthRequired,
); );
}); });
it('should fail if the length between the offset and end of the byte array is too short to hold the length of a nested byte array)', async () => { it('should fail if the length between the offset and end of the byte array is too short to hold the length of a nested byte array', async () => {
const emptyByteArray = ethUtil.bufferToHex(new Buffer(shortTestBytesAsBuffer.byteLength)); const emptyByteArray = ethUtil.bufferToHex(new Buffer(shortTestBytesAsBuffer.byteLength));
const badOffset = new BigNumber(ethUtil.toBuffer(shortTestBytesAsBuffer).byteLength); const badOffset = new BigNumber(ethUtil.toBuffer(shortTestBytesAsBuffer).byteLength);
return expectContractCallFailed( return expectContractCallFailed(