feat: add persistent unique tags to player nicknames
This commit is contained in:
@@ -1,6 +1,13 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { profileNameError } from '../src/shared/profile-name.js';
|
||||
import { formatProfileName, profileNameError } from '../src/shared/profile-name.js';
|
||||
|
||||
test('name tags distinguish duplicate nicknames and keep all digits beyond four places', () => {
|
||||
assert.equal(formatProfileName({ displayName: '손오공', nameTag: 1 }), '손오공#0001');
|
||||
assert.equal(formatProfileName({ displayName: '손오공', nameTag: 2 }), '손오공#0002');
|
||||
assert.equal(formatProfileName({ displayName: '손오공', nameTag: 10000 }), '손오공#10000');
|
||||
assert.equal(profileNameError('손오공#0001'), 'INVALID_PROFILE_NAME');
|
||||
});
|
||||
|
||||
test('nickname validation accepts ordinary names and rejects profanity and separated variants', () => {
|
||||
for (const name of ['손오공', '무도가', '구름-1234', 'ClassMaster', '별빛 전사']) assert.equal(profileNameError(name), undefined, name);
|
||||
|
||||
Reference in New Issue
Block a user