parent
47c7b4b9cc
commit
21dfce2cbb
@ -898,7 +898,8 @@ describe('Endpoints', () => {
|
|||||||
userId: bob.id,
|
userId: bob.id,
|
||||||
}, alice);
|
}, alice);
|
||||||
|
|
||||||
assert.strictEqual('memo' in res.body, false);
|
// memoには常に文字列かnullが入っている(5cac151)
|
||||||
|
assert.strictEqual(res.body.memo, null);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('メモは個人ごとに独立して保存される', async () => {
|
test('メモは個人ごとに独立して保存される', async () => {
|
||||||
|
@ -31,7 +31,7 @@ describe('ユーザー', () => {
|
|||||||
}, {});
|
}, {});
|
||||||
};
|
};
|
||||||
|
|
||||||
// FIXME: 足りないキーがたくさんある
|
// BUG misskey-jsとjson-schemaと実際に返ってくるデータが全部違う
|
||||||
type UserLite = misskey.entities.UserLite & {
|
type UserLite = misskey.entities.UserLite & {
|
||||||
badgeRoles: any[],
|
badgeRoles: any[],
|
||||||
};
|
};
|
||||||
@ -55,6 +55,7 @@ describe('ユーザー', () => {
|
|||||||
return successfulApiCall({ endpoint: 'users/show', parameters: { userId: id }, user: me }) as any;
|
return successfulApiCall({ endpoint: 'users/show', parameters: { userId: id }, user: me }) as any;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// UserLiteのキーが過不足なく入っている?
|
||||||
const userLite = (user: User): Partial<UserLite> => {
|
const userLite = (user: User): Partial<UserLite> => {
|
||||||
return stripUndefined({
|
return stripUndefined({
|
||||||
id: user.id,
|
id: user.id,
|
||||||
@ -76,6 +77,7 @@ describe('ユーザー', () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// UserDetailedNotMeのキーが過不足なく入っている?
|
||||||
const userDetailedNotMe = (user: User): Partial<UserDetailedNotMe> => {
|
const userDetailedNotMe = (user: User): Partial<UserDetailedNotMe> => {
|
||||||
return stripUndefined({
|
return stripUndefined({
|
||||||
...userLite(user),
|
...userLite(user),
|
||||||
@ -109,9 +111,11 @@ describe('ユーザー', () => {
|
|||||||
usePasswordLessLogin: user.usePasswordLessLogin,
|
usePasswordLessLogin: user.usePasswordLessLogin,
|
||||||
securityKeys: user.securityKeys,
|
securityKeys: user.securityKeys,
|
||||||
roles: user.roles,
|
roles: user.roles,
|
||||||
|
memo: user.memo,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Relations関連のキーが過不足なく入っている?
|
||||||
const userDetailedNotMeWithRelations = (user: User): Partial<UserDetailedNotMe> => {
|
const userDetailedNotMeWithRelations = (user: User): Partial<UserDetailedNotMe> => {
|
||||||
return stripUndefined({
|
return stripUndefined({
|
||||||
...userDetailedNotMe(user),
|
...userDetailedNotMe(user),
|
||||||
@ -126,6 +130,7 @@ describe('ユーザー', () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// MeDetailedのキーが過不足なく入っている?
|
||||||
const meDetailed = (user: User, security = false): Partial<MeDetailed> => {
|
const meDetailed = (user: User, security = false): Partial<MeDetailed> => {
|
||||||
return stripUndefined({
|
return stripUndefined({
|
||||||
...userDetailedNotMe(user),
|
...userDetailedNotMe(user),
|
||||||
@ -371,6 +376,7 @@ describe('ユーザー', () => {
|
|||||||
assert.strictEqual(response.usePasswordLessLogin, false);
|
assert.strictEqual(response.usePasswordLessLogin, false);
|
||||||
assert.strictEqual(response.securityKeys, false);
|
assert.strictEqual(response.securityKeys, false);
|
||||||
assert.deepStrictEqual(response.roles, []);
|
assert.deepStrictEqual(response.roles, []);
|
||||||
|
assert.strictEqual(response.memo, null);
|
||||||
|
|
||||||
// MeDetailedOnly
|
// MeDetailedOnly
|
||||||
assert.strictEqual(response.avatarId, null);
|
assert.strictEqual(response.avatarId, null);
|
||||||
@ -410,7 +416,7 @@ describe('ユーザー', () => {
|
|||||||
//#endregion
|
//#endregion
|
||||||
//#region 自分の情報(i)
|
//#region 自分の情報(i)
|
||||||
|
|
||||||
test('を読み取ることができる。(自分)', async () => {
|
test('を読み取ることができること(自分)、キーが過不足なく入っていること。', async () => {
|
||||||
const response = await successfulApiCall({
|
const response = await successfulApiCall({
|
||||||
endpoint: 'i',
|
endpoint: 'i',
|
||||||
parameters: {},
|
parameters: {},
|
||||||
@ -554,6 +560,21 @@ describe('ユーザー', () => {
|
|||||||
assert.deepStrictEqual(response2, expected2);
|
assert.deepStrictEqual(response2, expected2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
//#region メモの更新(users/update-memo)
|
||||||
|
|
||||||
|
test.each([
|
||||||
|
{ label: '最大長', memo: 'x'.repeat(2048) },
|
||||||
|
{ label: '空文字', memo: '', expects: null },
|
||||||
|
{ label: 'null', memo: null },
|
||||||
|
])('を書き換えることができる(メモを$labelに)', async ({ memo, expects }) => {
|
||||||
|
const expected = { ...await show(bob.id), memo: expects === undefined ? memo : expects };
|
||||||
|
const parameters = { userId: bob.id, memo };
|
||||||
|
await successfulApiCall({ endpoint: 'users/update-memo', parameters, user: alice });
|
||||||
|
const response = await show(bob.id);
|
||||||
|
assert.deepStrictEqual(response, expected);
|
||||||
|
});
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
//#region ユーザー(users)
|
//#region ユーザー(users)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user