mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-10-16 07:25:44 -04:00
fix(imports): show a readable file format in the upload hint
The upload hint interpolated the raw `accept` string, so Trakt rendered
as "Upload a .json,.zip export…". Derive a label from `accept` with a new
locale-aware `formatList` helper ("JSON or ZIP"), and wrap the source
card descriptions in `msg` so they are translatable.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
15 files changed
+182
-7
No files matched your search
@@ -7,6 +7,7 @@ vi.mock("../src/index", () => ({
|
||||
import {
|
||||
formatBytes,
|
||||
formatDate,
|
||||
formatList,
|
||||
formatNumber,
|
||||
formatRelativeTime,
|
||||
formatShortDate,
|
||||
@@ -146,3 +147,17 @@ describe("formatBytes", () => {
|
||||
expect(formatBytes(1536 * 1024)).toBe("1.5 MB");
|
||||
});
|
||||
});
|
||||
|
||||
describe("formatList", () => {
|
||||
test("joins items as a conjunction by default", () => {
|
||||
expect(formatList(["A", "B", "C"])).toBe("A, B, and C");
|
||||
});
|
||||
|
||||
test("supports disjunctions", () => {
|
||||
expect(formatList(["ZIP", "JSON"], { type: "disjunction" })).toBe("ZIP or JSON");
|
||||
});
|
||||
|
||||
test("returns a single item unchanged", () => {
|
||||
expect(formatList(["ZIP"], { type: "disjunction" })).toBe("ZIP");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user