added name test num greater then 5

This commit is contained in:
Eric Passmore
2023-06-21 10:11:34 -07:00
parent 2ae9f8c6b4
commit 9478ffa507
+20
View File
@@ -844,6 +844,15 @@ describe('Name Bytes and String Deserialization', () => {
const testValue = thisType.deserialize(buffer);
expect(testValue).toEqual(expected);
});
it('check name strips numbers greater then 5', () => {
const hex = "000000008002D031";
const type = "name";
const expected = "abc.5";
buffer.pushArray(ser.hexToUint8Array(hex));
const thisType = ser.getType(transactionType, type);
const testValue = thisType.deserialize(buffer);
expect(testValue).toEqual(expected);
});
// this is a weird one.
// when you deserialize a name ending with "..."
// eosjs-serialize silently drops the trailing dots
@@ -1843,6 +1852,17 @@ describe('Name Bytes and String Serialization', () => {
expect(hex).toBeTruthy();
expect(hex).toEqual(expected);
});
it('check number larger then 5', () => {
const expected = "000000008002D031";
const type = "name";
// ok to serialize in but on deserialization will get striped out
const testValue = "abc.578";
const thisType = ser.getType(transactionType, type);
thisType.serialize(buffer, testValue);
const hex = ser.arrayToHex(buffer.asUint8Array());
expect(hex).toBeTruthy();
expect(hex).toEqual(expected);
});
it('check empty byte', () => {
const expected = "00";
const type = "bytes";