Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Allowing a name to be an empty string (develop branch) #791

Merged
merged 2 commits into from
Sep 11, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/eosjs-serialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
7 changes: 0 additions & 7 deletions src/tests/eosjs-serialize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down