listPrivateMessages,
deletePrivateMessage,
unfollowRemotes,
- delay,
- longDelay,
} from './shared';
let recipient_id: number;
beforeAll(async () => {
await setupLogins();
let follow = await followBeta(alpha);
- await longDelay();
recipient_id = follow.community_view.creator.id;
});
expect(pmRes.private_message_view.private_message.local).toBe(true);
expect(pmRes.private_message_view.creator.local).toBe(true);
expect(pmRes.private_message_view.recipient.local).toBe(false);
- await delay();
let betaPms = await listPrivateMessages(beta);
expect(betaPms.private_messages[0].private_message.content).toBeDefined();
expect(pmUpdated.private_message_view.private_message.content).toBe(
updatedContent
);
- await longDelay();
let betaPms = await listPrivateMessages(beta);
expect(betaPms.private_messages[0].private_message.content).toBe(
test('Delete a private message', async () => {
let pmRes = await createPrivateMessage(alpha, recipient_id);
- await delay();
let betaPms1 = await listPrivateMessages(beta);
let deletedPmRes = await deletePrivateMessage(
alpha,
pmRes.private_message_view.private_message.id
);
expect(deletedPmRes.private_message_view.private_message.deleted).toBe(true);
- await delay();
// The GetPrivateMessages filters out deleted,
// even though they are in the actual database.
expect(betaPms2.private_messages.length).toBe(
betaPms1.private_messages.length - 1
);
- await delay();
// Undelete
let undeletedPmRes = await deletePrivateMessage(
expect(undeletedPmRes.private_message_view.private_message.deleted).toBe(
false
);
- await longDelay();
let betaPms3 = await listPrivateMessages(beta);
expect(betaPms3.private_messages.length).toBe(