username (string): Unique identifier for the user.
firstName (string): First name of the user.
lastName (string): Last name of the user.
organization (string): Name of the organization the user belongs to.
email (string): Email address of the user.
preferredLanguage (string): User’s preferred language for the interface.
role (string): Role assigned to the user (e.g., Admin, User, Guest).
Description: The constructor initializes the V3BiUserBase instance with the provided attributes.
Example Usage
const user = new V3BiUserBase(
'jdoe',
'John',
'Doe',
'Acme Corp',
'jdoe@example.com',
'en',
'Admin'
);
Specification in Tabular Form (Given, When, Then)
Attributes
Scenario
Given
When
Then
Create an instance with all attributes
The username is 'jdoe', firstName is 'John', lastName is 'Doe', organization is 'Acme Corp', email is 'jdoe@example.com', preferredLanguage is 'en', role is 'Admin'
I create a new V3BiUserBase with the provided attributes
The instance should have the specified attributes
Handle empty string as an attribute
The username is '', firstName is 'John', lastName is 'Doe', organization is 'Acme Corp', email is 'jdoe@example.com', preferredLanguage is 'en', role is 'Admin'
I create a new V3BiUserBase with an empty username and other valid attributes
The instance should have username as '' and other attributes as specified
Handle undefined as an attribute
The username is 'jdoe', firstName is 'John', lastName is 'Doe', organization is 'Acme Corp', email is 'jdoe@example.com', preferredLanguage is undefined, role is 'Admin'
I create a new V3BiUserBase with preferredLanguage as undefined and other valid attributes
The instance should have preferredLanguage as undefined and other attributes as specified
Handle special characters in attributes
The username is 'jdoe@#$', firstName is 'John', lastName is 'Doe', organization is 'Acme Corp', email is 'jdoe@example.com', preferredLanguage is 'en', role is 'Admin'
I create a new V3BiUserBase with special characters in username and other valid attributes
The instance should have username as 'jdoe@#$' and other attributes as specified
Handle a valid role attribute
The username is 'jdoe', firstName is 'John', lastName is 'Doe', organization is 'Acme Corp', email is 'jdoe@example.com', preferredLanguage is 'en', role is 'Admin'
I create a new V3BiUserBase with the provided attributes
The instance should have role as 'Admin' and other attributes as specified
Methods
Scenario
Given
When
Then
Initialize a user with the constructor
All necessary attributes (username, firstName, lastName, organization, email, preferredLanguage, role)
I create a new instance of V3BiUserBase with these attributes
The instance should be initialized with the specified attributes
Handle missing or empty attributes
Missing or empty attributes for username, firstName, lastName, organization, email, preferredLanguage, or role
I create a new instance of V3BiUserBase with missing or empty attributes
The instance should be initialized with default or undefined values where attributes are missing or empty
Handle special characters in attributes
Special characters in attributes like username, firstName, lastName, etc.
I create a new instance of V3BiUserBase with these attributes
The instance should correctly store the attributes with special characters