chore: changes based on review

This commit is contained in:
Ephraim Atta-Duncan
2024-10-18 01:12:43 +00:00
parent 2a098f89fa
commit 4348a949dd
3 changed files with 11 additions and 11 deletions

View File

@ -632,10 +632,10 @@ test('[DOCUMENT_FLOW]: should be able to create and sign a document with 3 recip
} }
// Wait for the document to be signed. // Wait for the document to be signed.
await page.waitForTimeout(5000); await expect(async () => {
const signedDocument = await getDocumentById({ id: document.id, userId: user.id });
const signedDocument = await getDocumentById({ id: document.id, userId: user.id }); expect(signedDocument?.status).toBe(DocumentStatus.COMPLETED);
expect(signedDocument?.status).toBe(DocumentStatus.COMPLETED); }).toPass();
}); });
test('[DOCUMENT_FLOW]: should prevent out-of-order signing in sequential mode', async ({ test('[DOCUMENT_FLOW]: should prevent out-of-order signing in sequential mode', async ({
@ -747,8 +747,8 @@ test('[DOCUMENT_FLOW]: should be able to self sign a document', async ({ page })
const updatedRecipient = await getRecipientById({ documentId: document.id, id: recipientId }); const updatedRecipient = await getRecipientById({ documentId: document.id, id: recipientId });
expect(updatedRecipient?.signingStatus).toBe(SigningStatus.SIGNED); expect(updatedRecipient?.signingStatus).toBe(SigningStatus.SIGNED);
await page.waitForTimeout(5000); await expect(async () => {
const signedDocument = await getDocumentById({ id: document.id, userId: user.id });
const signedDocument = await getDocumentById({ id: document.id, userId: user.id }); expect(signedDocument?.status).toBe(DocumentStatus.COMPLETED);
expect(signedDocument?.status).toBe(DocumentStatus.COMPLETED); }).toPass();
}); });

View File

@ -31,7 +31,7 @@ export const selfSignDocument = async ({
}, },
}); });
const document = await prisma.document.findUnique({ const document = await prisma.document.findFirstOrThrow({
where: { where: {
id: documentId, id: documentId,
userId, userId,
@ -64,7 +64,7 @@ export const selfSignDocument = async ({
const { documentData } = document; const { documentData } = document;
if (!documentData.data) { if (!documentData || !documentData.data) {
throw new Error('Document data not found'); throw new Error('Document data not found');
} }

View File

@ -100,7 +100,7 @@ export const sendDocument = async ({
const { documentData } = document; const { documentData } = document;
if (!documentData.data) { if (!documentData || !documentData.data) {
throw new Error('Document data not found'); throw new Error('Document data not found');
} }