mirror of
https://github.com/documenso/documenso.git
synced 2026-07-26 18:04:55 +10:00
chore: merge main, resolve biome formatting conflicts
Merge origin/main into feat/external-2fa-codes. Resolve formatting conflicts caused by biome rollout; preserve both feature streams: PR's external 2FA token + signing-session 2FA proof additions plus main's RateLimit/RecipientExpired/signingReminders/date-auto-insert. In complete-document-with-token.ts, drop the duplicate early field-fetching block introduced when main moved that logic later with date auto-insert support; keep the EXTERNAL_TWO_FACTOR_AUTH check using derivedRecipientActionAuth.
This commit is contained in:
@@ -1,11 +1,6 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
import { NEXT_PUBLIC_WEBAPP_URL } from '@documenso/lib/constants/app';
|
||||
import { createApiToken } from '@documenso/lib/server-only/public-api/create-api-token';
|
||||
import {
|
||||
mapSecondaryIdToDocumentId,
|
||||
mapSecondaryIdToTemplateId,
|
||||
} from '@documenso/lib/utils/envelope';
|
||||
import { mapSecondaryIdToDocumentId, mapSecondaryIdToTemplateId } from '@documenso/lib/utils/envelope';
|
||||
import { prisma } from '@documenso/prisma';
|
||||
import { DocumentDataType, FieldType } from '@documenso/prisma/client';
|
||||
import {
|
||||
@@ -16,6 +11,7 @@ import {
|
||||
} from '@documenso/prisma/seed/documents';
|
||||
import { seedBlankTemplate, seedTemplate } from '@documenso/prisma/seed/templates';
|
||||
import { seedUser } from '@documenso/prisma/seed/users';
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
const WEBAPP_BASE_URL = NEXT_PUBLIC_WEBAPP_URL();
|
||||
|
||||
@@ -25,9 +21,7 @@ test.describe.configure({
|
||||
|
||||
test.describe('Document Access API V1', () => {
|
||||
test.describe('Document GET endpoint', () => {
|
||||
test('should block unauthorized access to documents not owned by the user', async ({
|
||||
request,
|
||||
}) => {
|
||||
test('should block unauthorized access to documents not owned by the user', async ({ request }) => {
|
||||
const { user: userA, team: teamA } = await seedUser();
|
||||
|
||||
const { user: userB, team: teamB } = await seedUser();
|
||||
@@ -319,9 +313,7 @@ test.describe('Document Access API V1', () => {
|
||||
});
|
||||
|
||||
test.describe('Document recipients POST endpoint', () => {
|
||||
test('should block unauthorized access to document recipients endpoint', async ({
|
||||
request,
|
||||
}) => {
|
||||
test('should block unauthorized access to document recipients endpoint', async ({ request }) => {
|
||||
const { user: userA, team: teamA } = await seedUser();
|
||||
|
||||
const { user: userB, team: teamB } = await seedUser();
|
||||
@@ -371,9 +363,7 @@ test.describe('Document Access API V1', () => {
|
||||
});
|
||||
|
||||
test.describe('Document recipients PATCH endpoint', () => {
|
||||
test('should block unauthorized access to PATCH on recipients endpoint', async ({
|
||||
request,
|
||||
}) => {
|
||||
test('should block unauthorized access to PATCH on recipients endpoint', async ({ request }) => {
|
||||
const { user: userA, team: teamA } = await seedUser();
|
||||
|
||||
const { user: userB, team: teamB } = await seedUser();
|
||||
@@ -459,9 +449,7 @@ test.describe('Document Access API V1', () => {
|
||||
});
|
||||
|
||||
test.describe('Document recipients DELETE endpoint', () => {
|
||||
test('should block unauthorized access to DELETE on recipients endpoint', async ({
|
||||
request,
|
||||
}) => {
|
||||
test('should block unauthorized access to DELETE on recipients endpoint', async ({ request }) => {
|
||||
const { user: userA, team: teamA } = await seedUser();
|
||||
|
||||
const { user: userB, team: teamB } = await seedUser();
|
||||
@@ -972,9 +960,7 @@ test.describe('Document Access API V1', () => {
|
||||
|
||||
expect(resB.ok()).toBeTruthy();
|
||||
expect(resB.status()).toBe(200);
|
||||
expect(reqData.documents.every((doc: { userId: number }) => doc.userId !== userA.id)).toBe(
|
||||
true,
|
||||
);
|
||||
expect(reqData.documents.every((doc: { userId: number }) => doc.userId !== userA.id)).toBe(true);
|
||||
expect(reqData.documents.length).toBe(0);
|
||||
expect(reqData.totalPages).toBe(0);
|
||||
});
|
||||
@@ -999,9 +985,7 @@ test.describe('Document Access API V1', () => {
|
||||
expect(resA.ok()).toBeTruthy();
|
||||
expect(resA.status()).toBe(200);
|
||||
expect(reqData.documents.length).toBeGreaterThan(0);
|
||||
expect(reqData.documents.every((doc: { userId: number }) => doc.userId === userA.id)).toBe(
|
||||
true,
|
||||
);
|
||||
expect(reqData.documents.every((doc: { userId: number }) => doc.userId === userA.id)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1027,9 +1011,7 @@ test.describe('Document Access API V1', () => {
|
||||
|
||||
expect(resB.ok()).toBeTruthy();
|
||||
expect(resB.status()).toBe(200);
|
||||
expect(reqData.templates.every((tpl: { userId: number }) => tpl.userId !== userA.id)).toBe(
|
||||
true,
|
||||
);
|
||||
expect(reqData.templates.every((tpl: { userId: number }) => tpl.userId !== userA.id)).toBe(true);
|
||||
expect(reqData.templates.length).toBe(0);
|
||||
expect(reqData.totalPages).toBe(0);
|
||||
});
|
||||
@@ -1054,16 +1036,12 @@ test.describe('Document Access API V1', () => {
|
||||
expect(resA.ok()).toBeTruthy();
|
||||
expect(resA.status()).toBe(200);
|
||||
expect(reqData.templates.length).toBeGreaterThan(0);
|
||||
expect(reqData.templates.every((tpl: { userId: number }) => tpl.userId === userA.id)).toBe(
|
||||
true,
|
||||
);
|
||||
expect(reqData.templates.every((tpl: { userId: number }) => tpl.userId === userA.id)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Create document from template endpoint', () => {
|
||||
test('should block unauthorized access to create-document-from-template endpoint', async ({
|
||||
request,
|
||||
}) => {
|
||||
test('should block unauthorized access to create-document-from-template endpoint', async ({ request }) => {
|
||||
const { user: userA, team: teamA } = await seedUser();
|
||||
|
||||
const { user: userB, team: teamB } = await seedUser();
|
||||
@@ -1104,9 +1082,7 @@ test.describe('Document Access API V1', () => {
|
||||
expect(resB.status()).toBe(401);
|
||||
});
|
||||
|
||||
test('should allow authorized access to create-document-from-template endpoint', async ({
|
||||
request,
|
||||
}) => {
|
||||
test('should allow authorized access to create-document-from-template endpoint', async ({ request }) => {
|
||||
const { user: userA, team: teamA } = await seedUser();
|
||||
const { token: tokenA } = await createApiToken({
|
||||
userId: userA.id,
|
||||
|
||||
Reference in New Issue
Block a user