Files
anomalyco_opencode/packages/session-ui/src/components/message-file.test.ts
T

15 lines
743 B
TypeScript

import { describe, expect, test } from "bun:test"
import { typeLabel } from "./message-file"
describe("message-file", () => {
test("labels attachment types from the basename extension", () => {
expect(typeLabel("list.md", "text/plain", "File")).toBe("Markdown")
expect(typeLabel("/repo/src/main.ts", "text/plain", "File")).toBe("TypeScript")
expect(typeLabel("/tmp/report.pdf", "application/pdf", "File")).toBe("PDF")
expect(typeLabel("notes.xyz", "text/plain", "File")).toBe("XYZ")
expect(typeLabel("/home/user/my.project/Makefile", "text/plain", "File")).toBe("File")
expect(typeLabel(".gitignore", "text/plain", "File")).toBe("File")
expect(typeLabel("/repo/.env", "text/plain", "File")).toBe("File")
})
})