Skip to content

Commit c7b6b59

Browse files
committed
Fix tests
1 parent 0dac3db commit c7b6b59

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

apps/e2e/tests/backend/endpoints/api/v1/internal/feedback.test.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { randomUUID } from "crypto";
12
import { describe } from "vitest";
23
import { it } from "../../../../../helpers";
34
import { Auth, backendContext, createMailbox, niceBackendFetch, waitForOutboxEmailWithStatus } from "../../../../backend-helpers";
@@ -45,13 +46,14 @@ describe("POST /api/v1/internal/feedback", () => {
4546

4647
it("should send feedback without authentication (dev tool)", async ({ expect }) => {
4748
const recipientMailbox = createMailbox("team@stack-auth.com");
48-
const subject = "[Support] devtool-user@example.com";
49+
const senderEmail = `devtool-user-${randomUUID()}@example.com`;
50+
const subject = `[Support] ${senderEmail}`;
4951

5052
const response = await niceBackendFetch("/api/v1/internal/feedback", {
5153
method: "POST",
5254
body: {
5355
name: "Dev Tool User",
54-
email: "devtool-user@example.com",
56+
email: senderEmail,
5557
message: "Unauthenticated feedback from the dev tool.",
5658
feedback_type: "feedback",
5759
},
@@ -75,18 +77,19 @@ describe("POST /api/v1/internal/feedback", () => {
7577
const messages = await recipientMailbox.waitForMessagesWithSubject(subject);
7678
expect(messages).toHaveLength(1);
7779
expect(messages[0].body?.text).toContain("Dev Tool User");
78-
expect(messages[0].body?.text).toContain("devtool-user@example.com");
80+
expect(messages[0].body?.text).toContain(senderEmail);
7981
expect(messages[0].body?.text).toContain("Unauthenticated feedback from the dev tool.");
8082
});
8183

8284
it("should send bug reports with correct label", async ({ expect }) => {
8385
const recipientMailbox = createMailbox("team@stack-auth.com");
84-
const subject = "[Bug Report] bug@example.com";
86+
const reporterEmail = `bug-${randomUUID()}@example.com`;
87+
const subject = `[Bug Report] ${reporterEmail}`;
8588

8689
const response = await niceBackendFetch("/api/v1/internal/feedback", {
8790
method: "POST",
8891
body: {
89-
email: "bug@example.com",
92+
email: reporterEmail,
9093
message: "Something is broken.",
9194
feedback_type: "bug",
9295
},
@@ -109,7 +112,7 @@ describe("POST /api/v1/internal/feedback", () => {
109112

110113
const messages = await recipientMailbox.waitForMessagesWithSubject(subject);
111114
expect(messages).toHaveLength(1);
112-
expect(messages[0].subject).toBe("[Bug Report] bug@example.com");
115+
expect(messages[0].subject).toBe(subject);
113116
});
114117

115118
it("should reject invalid payloads", async ({ expect }) => {

claude/CLAUDE-KNOWLEDGE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,3 +258,6 @@ A: The app link wrapper in `docs-mintlify/snippets/docs-apps-home-grid.jsx` used
258258

259259
Q: How should the sidebar Apps filter behave when there are no matches?
260260
A: In `docs-mintlify/snippets/docs-apps-home-grid.jsx`, track visible rows while filtering and show a small inline empty state (`No more results. Clear filter`) when query is non-empty and visible count is zero; wire `Clear filter` to reset the input, rerun filtering, and refocus the input.
261+
262+
Q: Why did internal feedback E2E tests expect 1 Inbucket message but get 2?
263+
A: Inbucket persists mail across runs. `Mailbox.waitForMessagesWithSubject` waits until at least one match then returns **all** messages whose subject includes the string. Fixed subjects like `[Support] devtool-user@example.com` accumulate, so assertions should use a unique subject per run (e.g. `randomUUID()` in the sender email) or a baseline count before/after.

0 commit comments

Comments
 (0)