Don't prefill notification email for the local-dev bypass account

[email protected] is a fixed, non-deliverable placeholder (no mail
relay serves that domain, and Mailpit was removed a while back) - prefilling
it was just noise the local dev would always need to clear. Real accounts
still get their own email prefilled as before.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
2026-08-05 21:28:35 -04:00
co-authored by Claude Sonnet 5
parent 5b450f22cf
commit 6343ea19db
2 changed files with 51 additions and 4 deletions
+42 -1
View File
@@ -61,7 +61,7 @@ const CURRENT_USER = {
auth_mode: "local",
};
function mockFetchImplementation(existingCompanies: unknown[] = []) {
function mockFetchImplementation(existingCompanies: unknown[] = [], isLocalhost = false) {
return vi.fn().mockImplementation((url: string, init?: RequestInit) => {
const path = url.replace("http://localhost:8000", "");
if (path === "/api/v1/companies/discover" && init?.method === "POST") {
@@ -73,6 +73,25 @@ function mockFetchImplementation(existingCompanies: unknown[] = []) {
if (path === "/api/v1/auth/me") {
return Promise.resolve({ ok: true, status: 200, json: async () => CURRENT_USER });
}
if (path === "/api/v1/system/status") {
return Promise.resolve({
ok: true,
status: 200,
json: async () => ({
app_env: "development",
auth_mode: "local",
llm_provider: "mock",
search_provider: "mock",
sms_enabled: false,
sms_provider: "twilio",
ninjapear_configured: false,
ninjapear_credit_balance: null,
ninjapear_estimated_credits_per_company: null,
is_localhost: isLocalhost,
components: [],
}),
});
}
return Promise.resolve({ ok: false, status: 404, json: async () => ({ detail: "not found" }) });
});
}
@@ -163,4 +182,26 @@ describe("AddCompanyWizardPage", () => {
await user.type(email, "[email protected]");
expect(email.value).toBe("[email protected]");
});
it("leaves the notification email blank for the local-dev bypass account", async () => {
// [email protected] isn't a real, deliverable address (no mail relay
// serves that domain) - prefilling it would just be noise to clear.
vi.stubGlobal("fetch", mockFetchImplementation([], true));
const user = userEvent.setup();
renderWithQueryClient(<AddCompanyWizardPage />);
await user.type(screen.getByLabelText("Company name"), "Acme Widgets");
await user.click(screen.getByRole("button", { name: /discover company/i }));
await waitFor(() => {
expect(screen.getByText(/here's what we found for/i)).toBeInTheDocument();
});
await user.click(screen.getByRole("button", { name: /^continue$/i })); // Review -> Schedule
await user.click(screen.getByRole("button", { name: /^continue$/i })); // Schedule -> Notifications
const email = (await screen.findByLabelText("Notification email")) as HTMLInputElement;
// Give any async prefill effect a chance to run before asserting it didn't.
await new Promise((resolve) => setTimeout(resolve, 50));
expect(email.value).toBe("");
});
});