mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-10-31 09:10:44 +08:00
25 lines
656 B
TypeScript
25 lines
656 B
TypeScript
import { describe, expect, test } from "vitest";
|
|
|
|
import { basename, embedPreviewKind } from "@app/lib/embeds";
|
|
|
|
describe("basename", () => {
|
|
test.each([
|
|
["/home/alice/cat.png", "cat.png"],
|
|
["C:\\Users\\alice\\cat.png", "cat.png"],
|
|
["cat.png", "cat.png"],
|
|
])("of %j is %j", (path, expected) => {
|
|
expect(basename(path)).toBe(expected);
|
|
});
|
|
});
|
|
|
|
test.each([
|
|
["image/png", "image"],
|
|
["application/pdf", "document"],
|
|
["video/mp4", "video"],
|
|
["audio/ogg", "audio"],
|
|
["text/plain", undefined],
|
|
[null, undefined],
|
|
])("a %j embed previews as %j", (mimeType, expected) => {
|
|
expect(embedPreviewKind(mimeType)).toBe(expected);
|
|
});
|