Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

add language test in codemirror (#6296)

Shahmir Varqhaa8fc7a1430e5
diff --git a/frontend/src/plugins/impl/code/__tests__/language.test.ts b/frontend/src/plugins/impl/code/__tests__/language.test.ts
new file mode 100644
index 0000000000..6fc07eb336
--- /dev/null
+++ b/frontend/src/plugins/impl/code/__tests__/language.test.ts
@@ -0,0 +1,15 @@
+/* Copyright 2024 Marimo. All rights reserved. */
+
+import { langs } from "@uiw/codemirror-extensions-langs";
+import { describe, expect, it } from "vitest";
+import { LANGUAGE_MAP } from "../any-language-editor";
+
+describe("Codemirror Languages", () => {
+ const codemirrorLanguages = Object.keys(langs);
+
+ it("LANGUAGE_MAP should have all the languages in CodeMirror", () => {
+ for (const language of Object.values(LANGUAGE_MAP)) {
+ expect(codemirrorLanguages).toContain(language);
+ }
+ });
+});
diff --git a/frontend/src/plugins/impl/code/any-language-editor.tsx b/frontend/src/plugins/impl/code/any-language-editor.tsx
index 7335a7d211..c1664950eb 100644
--- a/frontend/src/plugins/impl/code/any-language-editor.tsx
+++ b/frontend/src/plugins/impl/code/any-language-editor.tsx
@@ -11,7 +11,7 @@ import type { ResolvedTheme } from "@/theme/useTheme";
import { Logger } from "@/utils/Logger";
import { ErrorBanner } from "../common/error-banner";
-const LANGUAGE_MAP: Record<string, string> = {
+export const LANGUAGE_MAP: Record<string, string> = {
python: "py",
javascript: "js",
typescript: "ts",