diff --git a/src/eosjs-serialize.ts b/src/eosjs-serialize.ts index e44ba5acc..a457dafcb 100644 --- a/src/eosjs-serialize.ts +++ b/src/eosjs-serialize.ts @@ -353,7 +353,7 @@ export class SerialBuffer { if (typeof s !== 'string') { throw new Error('Expected string containing name'); } - const regex = new RegExp(/^[.1-5a-z]{1,12}[.1-5a-j]?$/); + const regex = new RegExp(/^[.1-5a-z]{0,12}[.1-5a-j]?$/); if (!regex.test(s)) { throw new Error('Name should be less than 13 characters, or less than 14 if last character is between 1-5 or a-j, and only contain the following symbols .12345abcdefghijklmnopqrstuvwxyz'); // eslint-disable-line } diff --git a/src/tests/eosjs-serialize.test.ts b/src/tests/eosjs-serialize.test.ts index 011fdc613..9178741e1 100644 --- a/src/tests/eosjs-serialize.test.ts +++ b/src/tests/eosjs-serialize.test.ts @@ -114,13 +114,6 @@ describe('Serialize', () => { expect(serialBuffer.getName()).toEqual(expectedName); }); - it('should not be able to push name with an account name too short', () => { - const name = ''; - - const shouldFail = () => serialBuffer.pushName(name); - expect(shouldFail).toThrowError(invalidNameErrorMessage); - }); - it('should not be able to push name with an account name too long', () => { const name = 'abcdabcdabcdab';