mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-10-07 16:19:05 +08:00
Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Graham Neubig <neubig@gmail.com> Co-authored-by: hieptl <hieptl.developer@gmail.com>
27 lines
1005 B
TypeScript
27 lines
1005 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { isMarkdownFilePath } from "#/utils/is-markdown-file-path";
|
|
|
|
describe("isMarkdownFilePath", () => {
|
|
it("matches markdown extensions", () => {
|
|
expect(isMarkdownFilePath("canvas.md")).toBe(true);
|
|
expect(isMarkdownFilePath("/workspace/project/report.markdown")).toBe(true);
|
|
expect(isMarkdownFilePath("docs/page.mdx")).toBe(true);
|
|
});
|
|
|
|
it("matches extensions case-insensitively", () => {
|
|
expect(isMarkdownFilePath("README.MD")).toBe(true);
|
|
expect(isMarkdownFilePath("notes.Markdown")).toBe(true);
|
|
});
|
|
|
|
it("uses only the last extension of dotted names", () => {
|
|
expect(isMarkdownFilePath("foo.bar.md")).toBe(true);
|
|
expect(isMarkdownFilePath("report.md.bak")).toBe(false);
|
|
});
|
|
|
|
it("rejects paths without a markdown extension", () => {
|
|
expect(isMarkdownFilePath("Makefile")).toBe(false);
|
|
expect(isMarkdownFilePath("/workspace/app.ts")).toBe(false);
|
|
expect(isMarkdownFilePath("")).toBe(false);
|
|
});
|
|
});
|