add e2e test of accepting the new account automatically
This commit is contained in:
parent
3f8497d4f7
commit
bc7e801063
|
@ -160,6 +160,7 @@ export class UserFollowingService implements OnModuleInit {
|
||||||
followerId: oldAccount.id,
|
followerId: oldAccount.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
if (autoAccept) break;
|
||||||
} catch {
|
} catch {
|
||||||
/* skip if any error happens */
|
/* skip if any error happens */
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ describe('Account Move', () => {
|
||||||
let carol: any;
|
let carol: any;
|
||||||
let dave: any;
|
let dave: any;
|
||||||
let eve: any;
|
let eve: any;
|
||||||
|
let frank: any;
|
||||||
|
|
||||||
let Users: UsersRepository;
|
let Users: UsersRepository;
|
||||||
let Followings: FollowingsRepository;
|
let Followings: FollowingsRepository;
|
||||||
|
@ -37,6 +38,7 @@ describe('Account Move', () => {
|
||||||
carol = await signup({ username: 'carol' });
|
carol = await signup({ username: 'carol' });
|
||||||
dave = await signup({ username: 'dave' });
|
dave = await signup({ username: 'dave' });
|
||||||
eve = await signup({ username: 'eve' });
|
eve = await signup({ username: 'eve' });
|
||||||
|
frank = await signup({ username: 'frank' });
|
||||||
Users = connection.getRepository(User);
|
Users = connection.getRepository(User);
|
||||||
Followings = connection.getRepository(Following);
|
Followings = connection.getRepository(Following);
|
||||||
Blockings = connection.getRepository(Blocking);
|
Blockings = connection.getRepository(Blocking);
|
||||||
|
@ -151,6 +153,16 @@ describe('Account Move', () => {
|
||||||
await api('/following/create', {
|
await api('/following/create', {
|
||||||
userId: dave.id,
|
userId: dave.id,
|
||||||
}, eve);
|
}, eve);
|
||||||
|
|
||||||
|
await api('/i/update', {
|
||||||
|
isLocked: true,
|
||||||
|
}, frank);
|
||||||
|
await api('/following/create', {
|
||||||
|
userId: frank.id,
|
||||||
|
}, alice);
|
||||||
|
await api('/following/requests/accept', {
|
||||||
|
userId: alice.id,
|
||||||
|
}, frank);
|
||||||
}, 1000 * 10);
|
}, 1000 * 10);
|
||||||
|
|
||||||
test('Prohibit the root account from moving', async () => {
|
test('Prohibit the root account from moving', async () => {
|
||||||
|
@ -239,6 +251,19 @@ describe('Account Move', () => {
|
||||||
assert.strictEqual(newEve.followersCount, 1);
|
assert.strictEqual(newEve.followersCount, 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('A locked account automatically accept the follow request if it had already accepted the old account.', async () => {
|
||||||
|
await api('/following/create', {
|
||||||
|
userId: frank.id,
|
||||||
|
}, bob);
|
||||||
|
const followers = await api('/users/followers', {
|
||||||
|
userId: frank.id,
|
||||||
|
}, frank);
|
||||||
|
|
||||||
|
assert.strictEqual(followers.status, 200);
|
||||||
|
assert.strictEqual(followers.body.length, 2);
|
||||||
|
assert.strictEqual(followers.body[0].followerId, bob.id);
|
||||||
|
});
|
||||||
|
|
||||||
test.each([
|
test.each([
|
||||||
'/antennas/create',
|
'/antennas/create',
|
||||||
'/channels/create',
|
'/channels/create',
|
||||||
|
|
Loading…
Reference in a new issue