Skip to content

Open-source document signature platform. Not affiliated with DocuSign.

TypeScript

Start the e2e draft limit afresh too

Claude8ad5e7db0cf0
diff --git a/e2e/support/send-limit.ts b/e2e/support/send-limit.ts
index eec1954..8f73b31 100644
--- a/e2e/support/send-limit.ts
+++ b/e2e/support/send-limit.ts
@@ -6,12 +6,19 @@ import type pg from "pg";
// src/app/api/envelopes/[id]/send/route.ts), and together the tests send
// more than that as the administrator. A test that sends starts that count
// afresh, so whether it is refused does not depend on how many ran before.
+// The same goes for making drafts: twenty every ten minutes (the limit in
+// src/app/api/envelopes/route.ts), which the tests together go past.
export async function startSendLimitAfresh(
database: pg.Client,
userId: string,
): Promise<void> {
- await database.query("delete from public.rate_limits where key = $1", [
- createHash("sha256").update(`envelope-send:${userId}`).digest("hex"),
- ]);
+ await database.query(
+ "delete from public.rate_limits where key = any($1::text[])",
+ [
+ [`envelope-send:${userId}`, `draft-create:${userId}`].map((key) =>
+ createHash("sha256").update(key).digest("hex"),
+ ),
+ ],
+ );
}