@@ -20,4 +20,30 @@ describe('Federation identity deletion — server suite', () => {
|
||||
expect(harness.remote.origin).toMatch(/^http:\/\/127\.0\.0\.1:\d+$/);
|
||||
expect(sharedHmacSecret).toHaveLength(64);
|
||||
});
|
||||
|
||||
it('#11 returns 400 for invalid mode', async () => {
|
||||
const { createFederatedUser } = await import('./helpers/testUsers.js');
|
||||
const { homeUser } = await createFederatedUser(harness.home, harness.remote, 't11');
|
||||
const res = await fetch(`${harness.home.origin}/api/users/@me/federation-identity/delete`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${homeUser.token}` },
|
||||
body: JSON.stringify({ origins: [harness.remote.origin], mode: 'foo' }),
|
||||
});
|
||||
expect(res.status).toBe(400);
|
||||
const body = await res.json();
|
||||
expect(String(body.error)).toMatch(/Invalid mode/);
|
||||
});
|
||||
|
||||
it('#12 returns 400 for empty origins', async () => {
|
||||
const { createFederatedUser } = await import('./helpers/testUsers.js');
|
||||
const { homeUser } = await createFederatedUser(harness.home, harness.remote, 't12');
|
||||
const res = await fetch(`${harness.home.origin}/api/users/@me/federation-identity/delete`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${homeUser.token}` },
|
||||
body: JSON.stringify({ origins: [], mode: 'full' }),
|
||||
});
|
||||
expect(res.status).toBe(400);
|
||||
const body = await res.json();
|
||||
expect(String(body.error)).toMatch(/origins/);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user