Phase 1 foundation: backend, web profile, and mobile app
Greenfield implementation of CardClaws Phase 1 across three surfaces. Backend (Rust/Axum workspace, 67 tests): - cardclaws-types/config/db/auth/api/wallet crates - Auth: register, login + lockout, magic link, refresh rotation, Apple verify - Cards: CRUD, tier-limited publish, duplicate, public handle lookup - Assets: R2 presigned uploads; vCard export - Apple Wallet .pkpass pipeline (PKCS#7 signer behind apple-signing feature) - Analytics ingest + summary with daily-salted IP hashing - Migrations 0001 (incl. cardclaws_sessions) + 0002 analytics Web profile (Astro SSR): cardclaws.com/[handle] hero + flip, contact actions, client-built vCard, visit attribution. Verified end-to-end. Mobile (Expo SDK 51): auth, card list/create, builder v1 (bg/text/logo, palette, undo/redo), Skia/Reanimated viewer (flip + ambient). 22 logic tests. CI: policy/backend/profile/mobile jobs; LOC + no-placeholder lint. Review fixes baked in: `back` (not `cardclaws`) key; strip image is a bundled manifest file (not a URL); sessions table added; NFC reframed; test doubles allowed for external services. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import { buildVcard } from "../../src/engine/renderer/vcfExporter";
|
||||
|
||||
describe("vcfExporter (RFC 6350)", () => {
|
||||
it("produces a well-formed vCard 3.0", () => {
|
||||
const vcf = buildVcard("Omar Sobh", {
|
||||
title: "Founder",
|
||||
company: "RedClaw",
|
||||
email: "[email protected]",
|
||||
phone: "+15551234567",
|
||||
website: "https://redclaw.dev",
|
||||
});
|
||||
expect(vcf.startsWith("BEGIN:VCARD\r\nVERSION:3.0\r\n")).toBe(true);
|
||||
expect(vcf).toContain("FN:Omar Sobh\r\n");
|
||||
expect(vcf).toContain("N:Sobh;Omar;;;\r\n");
|
||||
expect(vcf).toContain("ORG:RedClaw\r\n");
|
||||
expect(vcf).toContain("TITLE:Founder\r\n");
|
||||
expect(vcf).toContain("TEL;TYPE=CELL:+15551234567\r\n");
|
||||
expect(vcf).toContain("EMAIL:[email protected]\r\n");
|
||||
expect(vcf.trimEnd().endsWith("END:VCARD")).toBe(true);
|
||||
});
|
||||
|
||||
it("omits absent fields", () => {
|
||||
const vcf = buildVcard("Solo", {});
|
||||
expect(vcf).not.toContain("ORG:");
|
||||
expect(vcf).not.toContain("TEL");
|
||||
expect(vcf).toContain("FN:Solo\r\n");
|
||||
});
|
||||
|
||||
it("escapes special characters", () => {
|
||||
const vcf = buildVcard("Solo", { company: "Red;Claw, Inc" });
|
||||
expect(vcf).toContain("ORG:Red\\;Claw\\, Inc\r\n");
|
||||
});
|
||||
|
||||
it("matches the backend output byte-for-byte for a known input", () => {
|
||||
const vcf = buildVcard("Omar Sobh", {
|
||||
title: "Founder & CEO",
|
||||
company: "RedClaw Systems",
|
||||
email: "[email protected]",
|
||||
phone: "+15551234567",
|
||||
website: "https://redclaw.dev",
|
||||
});
|
||||
const expected =
|
||||
"BEGIN:VCARD\r\nVERSION:3.0\r\nFN:Omar Sobh\r\nN:Sobh;Omar;;;\r\n" +
|
||||
"ORG:RedClaw Systems\r\nTITLE:Founder & CEO\r\nTEL;TYPE=CELL:+15551234567\r\n" +
|
||||
"EMAIL:[email protected]\r\nURL:https://redclaw.dev\r\nEND:VCARD\r\n";
|
||||
expect(vcf).toBe(expected);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user