fix test
This commit is contained in:
parent
fa52f1cb53
commit
244d911dcf
|
@ -1,5 +1,10 @@
|
||||||
import { strictEqual, rejects } from 'node:assert';
|
import { strictEqual, rejects } from 'node:assert';
|
||||||
import { createAccount, resolveRemoteUser, sleep, type LoginUser } from '../../utils.js';
|
import { createAccount, fetchAdmin, resolveRemoteUser, sleep, type LoginUser } from '../../utils.js';
|
||||||
|
|
||||||
|
const [aAdmin, bAdmin] = await Promise.all([
|
||||||
|
fetchAdmin('a.test'),
|
||||||
|
fetchAdmin('b.test'),
|
||||||
|
]);
|
||||||
|
|
||||||
describe('API ap/show', () => {
|
describe('API ap/show', () => {
|
||||||
let alice: LoginUser, bob: LoginUser;
|
let alice: LoginUser, bob: LoginUser;
|
||||||
|
@ -37,15 +42,16 @@ describe('API ap/show', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('resolve a fetched remote user by local profile url (https://a.test/@bob@b.test)', async () => {
|
test('resolve a fetched remote user by local profile url (https://a.test/@bob@b.test)', async () => {
|
||||||
await alice.client.request('admin/update-meta', { allowExternalApRedirect: true });
|
await aAdmin.client.request('admin/update-meta', { allowExternalApRedirect: true });
|
||||||
await resolveRemoteUser('b.test', bob.id, alice);
|
await resolveRemoteUser('b.test', bob.id, alice);
|
||||||
|
|
||||||
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');
|
||||||
strictEqual(res.object.uri, `https://b.test/users/${bob.id}`);
|
strictEqual(res.object.uri, `https://b.test/users/${bob.id}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('throws in resolving a fetched remote user by local profile url when allowExternalApRedirect: false', async () => {
|
test('throws in resolving a fetched remote user by local profile url when allowExternalApRedirect: false', async () => {
|
||||||
await alice.client.request('admin/update-meta', { allowExternalApRedirect: false });
|
await aAdmin.client.request('admin/update-meta', { allowExternalApRedirect: false });
|
||||||
await resolveRemoteUser('b.test', bob.id, alice);
|
await resolveRemoteUser('b.test', bob.id, alice);
|
||||||
|
|
||||||
await rejects(
|
await rejects(
|
||||||
|
@ -58,9 +64,10 @@ describe('API ap/show', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('throws in resolving a non-fetched remote user by local profile url (https://a.test/@bob@b.test)', async () => {
|
test('throws in resolving a non-fetched remote user by local profile url (https://a.test/@bob@b.test)', async () => {
|
||||||
// ユーザーがこのような問い合わせをすることは、ない!
|
// ユーザーがこのような問い合わせをすることは故意でない限りなさそうだし、ActivityPubServerServiceでもこのような仕様である
|
||||||
|
|
||||||
|
await aAdmin.client.request('admin/update-meta', { allowExternalApRedirect: true });
|
||||||
|
|
||||||
await alice.client.request('admin/update-meta', { allowExternalApRedirect: true });
|
|
||||||
await rejects(
|
await rejects(
|
||||||
async () => await alice.client.request('ap/show', { uri: `https://a.test/@${bob.username}@b.test` }),
|
async () => await alice.client.request('ap/show', { uri: `https://a.test/@${bob.username}@b.test` }),
|
||||||
(err: any) => {
|
(err: any) => {
|
||||||
|
|
Loading…
Reference in New Issue