This commit is contained in:
parent
e29fe18b93
commit
a30b029803
|
@ -4,30 +4,24 @@ import { createAccount, resolveRemoteUser, sleep, type LoginUser } from '../../u
|
||||||
|
|
||||||
describe('API ap/show', () => {
|
describe('API ap/show', () => {
|
||||||
let alice: LoginUser, bob: LoginUser;
|
let alice: LoginUser, bob: LoginUser;
|
||||||
let bobInA: Misskey.entities.UserDetailedNotMe;
|
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
[alice, bob] = await Promise.all([
|
[alice, bob] = await Promise.all([
|
||||||
createAccount('a.test'),
|
createAccount('a.test'),
|
||||||
createAccount('b.test'),
|
createAccount('b.test'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// 事前に bob を a.test に解決してキャッシュ・同一性を取る
|
|
||||||
bobInA = await resolveRemoteUser('b.test', bob.id, alice);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('User resolution', () => {
|
describe('User resolution', () => {
|
||||||
test('resolve by acct (bob@b.test)', async () => {
|
test('resolve by acct (bob@b.test)', async () => {
|
||||||
const res = await alice.client.request('ap/show', { uri: `${bob.username}@b.test` });
|
const res = await alice.client.request('ap/show', { uri: `${bob.username}@b.test` });
|
||||||
strictEqual(res.type, 'User');
|
strictEqual(res.type, 'User');
|
||||||
strictEqual(res.object.id, bobInA.id);
|
|
||||||
strictEqual(res.object.uri, `https://b.test/users/${bob.id}`);
|
strictEqual(res.object.uri, `https://b.test/users/${bob.id}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('resolve by canonical user URL (https://b.test/users/:id)', async () => {
|
test('resolve by canonical user URL (https://b.test/users/:id)', async () => {
|
||||||
const res = await alice.client.request('ap/show', { uri: `https://b.test/users/${bob.id}` });
|
const res = await alice.client.request('ap/show', { uri: `https://b.test/users/${bob.id}` });
|
||||||
strictEqual(res.type, 'User');
|
strictEqual(res.type, 'User');
|
||||||
strictEqual(res.object.id, bobInA.id);
|
|
||||||
strictEqual(res.object.uri, `https://b.test/users/${bob.id}`);
|
strictEqual(res.object.uri, `https://b.test/users/${bob.id}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -35,7 +29,6 @@ describe('API ap/show', () => {
|
||||||
const res = await alice.client.request('ap/show', { uri: `https://a.test/@${bob.username}@b.test` });
|
const res = await alice.client.request('ap/show', { uri: `https://a.test/@${bob.username}@b.test` });
|
||||||
strictEqual(res.type, 'User');
|
strictEqual(res.type, 'User');
|
||||||
// 非正規URLから正規IDに追従して同一ユーザーになること
|
// 非正規URLから正規IDに追従して同一ユーザーになること
|
||||||
strictEqual(res.object.id, bobInA.id);
|
|
||||||
strictEqual(res.object.uri, `https://b.test/users/${bob.id}`);
|
strictEqual(res.object.uri, `https://b.test/users/${bob.id}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -60,7 +53,8 @@ describe('API ap/show', () => {
|
||||||
strictEqual(res.type, 'Note');
|
strictEqual(res.type, 'Note');
|
||||||
strictEqual(res.object.uri, `https://b.test/notes/${note.id}`);
|
strictEqual(res.object.uri, `https://b.test/notes/${note.id}`);
|
||||||
// 投稿者が a.test 側で解決済みの Bob になること
|
// 投稿者が a.test 側で解決済みの Bob になること
|
||||||
strictEqual(res.object.userId, bobInA.id);
|
strictEqual(res.object.user.username, bob.username);
|
||||||
|
strictEqual(res.object.user.host, 'b.test');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue