feat: replace generated nicknames with filtered user input

This commit is contained in:
2026-10-26 18:04:09 +09:00
parent 5cef1c6f1e
commit fc45534c7d
11 changed files with 147 additions and 40 deletions
+11
View File
@@ -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');
});