fix(backend): 名前を空白文字列だけにできる問題を修正 (#14119)
* fix(backend): 名前を空白文字列だけにできる問題を修正
* Update Changelog
* fix test
* Unicodeを含める
* fix
* ユーザー名がUnicode制御文字とスペースのみで構成される場合はnullに
* Revert "ユーザー名がUnicode制御文字とスペースのみで構成される場合はnullに"
This reverts commit 6c752a69c0.
* [ci skip] changelog typo
			
			
This commit is contained in:
		@@ -117,12 +117,21 @@ describe('Endpoints', () => {
 | 
			
		||||
			assert.strictEqual(res.body.birthday, myBirthday);
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
		test('名前を空白にできる', async () => {
 | 
			
		||||
		test('名前を空白のみにした場合nullになる', async () => {
 | 
			
		||||
			const res = await api('i/update', {
 | 
			
		||||
				name: ' ',
 | 
			
		||||
			}, alice);
 | 
			
		||||
			assert.strictEqual(res.status, 200);
 | 
			
		||||
			assert.strictEqual(res.body.name, ' ');
 | 
			
		||||
			assert.strictEqual(res.body.name, null);
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
		test('名前の前後に空白(ホワイトスペース)を入れてもトリムされる', async () => {
 | 
			
		||||
			const res = await api('i/update', {
 | 
			
		||||
				// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#white_space
 | 
			
		||||
				name: ' あ い う \u0009\u000b\u000c\u0020\u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\ufeff',
 | 
			
		||||
			}, alice);
 | 
			
		||||
			assert.strictEqual(res.status, 200);
 | 
			
		||||
			assert.strictEqual(res.body.name, 'あ い う');
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
		test('誕生日の設定を削除できる', async () => {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user