feat: replace generated nicknames with filtered user input
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { profileNameError } from '../src/shared/profile-name.js';
|
||||
|
||||
test('nickname validation accepts ordinary names and rejects profanity and separated variants', () => {
|
||||
for (const name of ['손오공', '무도가', '구름-1234', 'ClassMaster', '별빛 전사']) assert.equal(profileNameError(name), undefined, name);
|
||||
for (const name of ['시발', '씨 발', '씨-발', 'ㅅㅂ', '병_신', 'FUCK', 'fuck', '씨\u200b발', '시1발']) {
|
||||
assert.equal(profileNameError(name), 'PROFILE_NAME_PROFANITY', name);
|
||||
}
|
||||
for (const name of ['', '가', '가'.repeat(17), '<img>', null, undefined, {}]) assert.equal(profileNameError(name), 'INVALID_PROFILE_NAME');
|
||||
});
|
||||
Reference in New Issue
Block a user