@gala-chain/test ∙ API
API > users
Variable: users
users:
object
Collection of predefined test users for common testing scenarios.
Provides commonly used user roles and identities to simplify test setup.
Example
import users from '@gala-chain/test/data/users';
// Use predefined users
const admin = users.admin;
const user1 = users.testUser1;
// Create new random user
const customUser = users.random("custom-user", ["CustomRole"]);
Type declaration
admin
admin:
ChainUserWithRoles&object
Type declaration
roles
roles:
string[]
attacker
attacker:
ChainUserWithRoles&object
Type declaration
roles
roles:
string[]
random
random: (
string?,roles) =>ChainUserWithRoles&object=randomUser
Creates a random user with specified roles for testing.
Parameters
▪ string?: string
Optional user alias/identifier. If not provided, generates eth|<addr> identifier
▪ roles?: string[]= undefined
Array of role strings, defaults to DEFAULT_ROLES
Returns
ChainUserWithRoles with cryptographic keys and role assignments
Example
// Create user with default roles
const user = randomUser();
// Create admin user
const admin = randomUser("admin", UserProfile.ADMIN_ROLES);
// Create user with custom roles
const curator = randomUser("curator", ["TokenCurator", "NFTManager"]);
testUser1
testUser1:
ChainUserWithRoles&object
Type declaration
roles
roles:
string[]
testUser2
testUser2:
ChainUserWithRoles&object
Type declaration
roles
roles:
string[]
testUser3
testUser3:
ChainUserWithRoles&object
Type declaration
roles
roles:
string[]
tokenHolder
tokenHolder:
ChainUserWithRoles&object
Type declaration
roles
roles:
string[]