add a test
This commit is contained in:
parent
0937d71c2f
commit
5d7240510e
|
@ -12,31 +12,31 @@ describe('API ap/show', () => {
|
|||
});
|
||||
|
||||
describe('User resolution', () => {
|
||||
test('resolve by canonical user URL (https://b.test/users/:id)', async () => {
|
||||
test('resolve a remote user 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}` });
|
||||
strictEqual(res.type, 'User');
|
||||
strictEqual(res.object.uri, `https://b.test/users/${bob.id}`);
|
||||
});
|
||||
|
||||
test('resolve by user profile URL (https://b.test/@bob)', async () => {
|
||||
test('resolve a remote user by user profile url (https://b.test/@bob)', async () => {
|
||||
const res = await alice.client.request('ap/show', { uri: `https://b.test/@${bob.username}` });
|
||||
strictEqual(res.type, 'User');
|
||||
strictEqual(res.object.uri, `https://b.test/users/${bob.id}`);
|
||||
});
|
||||
|
||||
test('resolve local user by local uri', async () => {
|
||||
test('resolve a local user by local uri', async () => {
|
||||
const res = await alice.client.request('ap/show', { uri: `https://a.test/users/${alice.id}` });
|
||||
strictEqual(res.type, 'User');
|
||||
strictEqual(res.object.id, alice.id);
|
||||
});
|
||||
|
||||
test('resolve local user by local profile url', async () => {
|
||||
test('resolve a local user by local profile url', async () => {
|
||||
const res = await alice.client.request('ap/show', { uri: `https://a.test/@${alice.username}` });
|
||||
strictEqual(res.type, 'User');
|
||||
strictEqual(res.object.id, alice.id);
|
||||
});
|
||||
|
||||
test('resolve remote user by local profile URL (https://a.test/@bob@b.test)', async () => {
|
||||
test('resolve a remote user by local profile URL (https://a.test/@bob@b.test)', async () => {
|
||||
const res = await alice.client.request('ap/show', { uri: `https://a.test/@${bob.username}@b.test` });
|
||||
strictEqual(res.type, 'User');
|
||||
strictEqual(res.object.uri, `https://b.test/users/${bob.id}`);
|
||||
|
@ -44,7 +44,7 @@ describe('API ap/show', () => {
|
|||
});
|
||||
|
||||
describe('Note resolution', () => {
|
||||
test('resolve by note URL (https://b.test/notes/:id)', async () => {
|
||||
test('resolve a remote note by note uri', async () => {
|
||||
const note = (await bob.client.request('notes/create', { text: 'hello from Bob' })).createdNote;
|
||||
await sleep();
|
||||
|
||||
|
@ -55,5 +55,15 @@ describe('API ap/show', () => {
|
|||
strictEqual(res.object.user.username, bob.username);
|
||||
strictEqual(res.object.user.host, 'b.test');
|
||||
});
|
||||
|
||||
test('resolve a local note by note uri', async () => {
|
||||
const note = (await alice.client.request('notes/create', { text: 'hello from Alice' })).createdNote;
|
||||
await sleep();
|
||||
|
||||
const res = await alice.client.request('ap/show', { uri: `https://a.test/notes/${note.id}` });
|
||||
strictEqual(res.type, 'Note');
|
||||
strictEqual(res.object.id, note.id);
|
||||
strictEqual(res.object.user.id, alice.id);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue