fix(backend): clips/updateのdescriptionで空文字を許容するように (#15429)
* fix(backend): clips/updateのdescriptionで空文字を許容するように * Update Changelog * fix: createの際も空文字を許容するように * fix test * fix test --------- Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
This commit is contained in:
@@ -182,7 +182,6 @@ describe('クリップ', () => {
|
||||
{ label: 'nameがnull', parameters: { name: null } },
|
||||
{ label: 'nameが最大長+1', parameters: { name: 'x'.repeat(101) } },
|
||||
{ label: 'isPublicがboolじゃない', parameters: { isPublic: 'true' } },
|
||||
{ label: 'descriptionがゼロ長', parameters: { description: '' } },
|
||||
{ label: 'descriptionが最大長+1', parameters: { description: 'a'.repeat(2049) } },
|
||||
];
|
||||
test.each(createClipDenyPattern)('の作成は$labelならできない', async ({ parameters }) => failedApiCall({
|
||||
@@ -199,6 +198,23 @@ describe('クリップ', () => {
|
||||
id: '3d81ceae-475f-4600-b2a8-2bc116157532',
|
||||
}));
|
||||
|
||||
test('の作成はdescriptionが空文字ならnullになる', async () => {
|
||||
const clip = await successfulApiCall({
|
||||
endpoint: 'clips/create',
|
||||
parameters: {
|
||||
...defaultCreate(),
|
||||
description: '',
|
||||
},
|
||||
user: alice,
|
||||
});
|
||||
|
||||
assert.deepStrictEqual(clip, {
|
||||
...clip,
|
||||
...defaultCreate(),
|
||||
description: null,
|
||||
});
|
||||
});
|
||||
|
||||
test('の更新ができる', async () => {
|
||||
const res = await update({
|
||||
clipId: (await create()).id,
|
||||
@@ -249,6 +265,24 @@ describe('クリップ', () => {
|
||||
...assertion,
|
||||
}));
|
||||
|
||||
test('の更新はdescriptionが空文字ならnullになる', async () => {
|
||||
const clip = await successfulApiCall({
|
||||
endpoint: 'clips/update',
|
||||
parameters: {
|
||||
clipId: (await create()).id,
|
||||
name: 'updated',
|
||||
description: '',
|
||||
},
|
||||
user: alice,
|
||||
});
|
||||
|
||||
assert.deepStrictEqual(clip, {
|
||||
...clip,
|
||||
name: 'updated',
|
||||
description: null,
|
||||
});
|
||||
});
|
||||
|
||||
test('の削除ができる', async () => {
|
||||
await deleteClip({
|
||||
clipId: (await create()).id,
|
||||
|
Reference in New Issue
Block a user