fix: replace misleading SDK claims with honest code examples messaging
Some checks failed
Build & Deploy to Staging / Build & Deploy to Staging (push) Failing after 1m3s
Some checks failed
Build & Deploy to Staging / Build & Deploy to Staging (push) Failing after 1m3s
This commit is contained in:
parent
50a163b12d
commit
9dcc473e78
4 changed files with 64 additions and 5 deletions
File diff suppressed because one or more lines are too long
|
|
@ -60,7 +60,7 @@
|
||||||
"name": "Do you have official SDKs?",
|
"name": "Do you have official SDKs?",
|
||||||
"acceptedAnswer": {
|
"acceptedAnswer": {
|
||||||
"@type": "Answer",
|
"@type": "Answer",
|
||||||
"text": "Yes, DocFast provides official SDKs for Node.js, Python, Go, PHP, and Laravel. You can also use the REST API directly with curl or any HTTP client."
|
"text": "DocFast provides code examples for Node.js, Python, Go, PHP, and cURL. Official SDK packages are coming soon. You can use the REST API directly with any HTTP client."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
@ -450,7 +450,7 @@ html, body {
|
||||||
<section class="features" id="features">
|
<section class="features" id="features">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h2 class="section-title">Everything you need</h2>
|
<h2 class="section-title">Everything you need</h2>
|
||||||
<p class="section-sub">Official SDKs for Node.js, Python, Go, PHP, and Laravel. Or just use curl.</p>
|
<p class="section-sub">Code examples for Node.js, Python, Go, PHP, and cURL. Official SDKs coming soon.</p>
|
||||||
<div class="features-grid">
|
<div class="features-grid">
|
||||||
<div class="feature-card">
|
<div class="feature-card">
|
||||||
<div class="feature-icon" aria-hidden="true">⚡</div>
|
<div class="feature-icon" aria-hidden="true">⚡</div>
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@
|
||||||
"name": "Do you have official SDKs?",
|
"name": "Do you have official SDKs?",
|
||||||
"acceptedAnswer": {
|
"acceptedAnswer": {
|
||||||
"@type": "Answer",
|
"@type": "Answer",
|
||||||
"text": "Yes, DocFast provides official SDKs for Node.js, Python, Go, PHP, and Laravel. You can also use the REST API directly with curl or any HTTP client."
|
"text": "DocFast provides code examples for Node.js, Python, Go, PHP, and cURL. Official SDK packages are coming soon. You can use the REST API directly with any HTTP client."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
@ -450,7 +450,7 @@ html, body {
|
||||||
<section class="features" id="features">
|
<section class="features" id="features">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h2 class="section-title">Everything you need</h2>
|
<h2 class="section-title">Everything you need</h2>
|
||||||
<p class="section-sub">Official SDKs for Node.js, Python, Go, PHP, and Laravel. Or just use curl.</p>
|
<p class="section-sub">Code examples for Node.js, Python, Go, PHP, and cURL. Official SDKs coming soon.</p>
|
||||||
<div class="features-grid">
|
<div class="features-grid">
|
||||||
<div class="feature-card">
|
<div class="feature-card">
|
||||||
<div class="feature-icon" aria-hidden="true">⚡</div>
|
<div class="feature-icon" aria-hidden="true">⚡</div>
|
||||||
|
|
|
||||||
59
src/__tests__/email.test.ts
Normal file
59
src/__tests__/email.test.ts
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||||
|
|
||||||
|
// Mock nodemailer before importing email service
|
||||||
|
const mockSendMail = vi.fn();
|
||||||
|
vi.mock("nodemailer", () => ({
|
||||||
|
default: {
|
||||||
|
createTransport: vi.fn(() => ({
|
||||||
|
sendMail: mockSendMail,
|
||||||
|
})),
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
|
// Mock logger
|
||||||
|
vi.mock("../services/logger.js", () => ({
|
||||||
|
default: { info: vi.fn(), error: vi.fn(), warn: vi.fn(), debug: vi.fn() },
|
||||||
|
}));
|
||||||
|
|
||||||
|
import { sendVerificationEmail } from "../services/email.js";
|
||||||
|
|
||||||
|
describe("Email Service", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
vi.clearAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("sendVerificationEmail", () => {
|
||||||
|
it("constructs correct email with code", async () => {
|
||||||
|
mockSendMail.mockResolvedValueOnce({ messageId: "test-123" });
|
||||||
|
|
||||||
|
const result = await sendVerificationEmail("user@example.com", "654321");
|
||||||
|
|
||||||
|
expect(result).toBe(true);
|
||||||
|
expect(mockSendMail).toHaveBeenCalledOnce();
|
||||||
|
|
||||||
|
const mailOptions = mockSendMail.mock.calls[0][0];
|
||||||
|
expect(mailOptions.to).toBe("user@example.com");
|
||||||
|
expect(mailOptions.subject).toContain("DocFast");
|
||||||
|
expect(mailOptions.subject).toContain("Verify");
|
||||||
|
expect(mailOptions.text).toContain("654321");
|
||||||
|
expect(mailOptions.html).toContain("654321");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("returns false when SMTP fails", async () => {
|
||||||
|
mockSendMail.mockRejectedValueOnce(new Error("SMTP connection refused"));
|
||||||
|
|
||||||
|
const result = await sendVerificationEmail("user@example.com", "123456");
|
||||||
|
|
||||||
|
expect(result).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("includes expiry notice in email body", async () => {
|
||||||
|
mockSendMail.mockResolvedValueOnce({ messageId: "test-456" });
|
||||||
|
|
||||||
|
await sendVerificationEmail("user@example.com", "111111");
|
||||||
|
|
||||||
|
const mailOptions = mockSendMail.mock.calls[0][0];
|
||||||
|
expect(mailOptions.text).toContain("15 minutes");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue