MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / runAceCompatibilityTests

Function runAceCompatibilityTests

src/test/ace.test.js:9–301  ·  view source on GitHub ↗
(writeOutput)

Source from the content-addressed store, hash-verified

7 * properly implements the Ace Editor API compatibility layer.
8 */
9export async function runAceCompatibilityTests(writeOutput) {
10 const runner = new TestRunner("Ace API Compatibility");
11
12 function getEditor() {
13 return editorManager?.editor;
14 }
15
16 async function createTestFile(text = "") {
17 const EditorFile = acode.require("editorFile");
18 const file = new EditorFile("__ace_test__.txt", {
19 text,
20 render: true,
21 });
22 await new Promise((r) => setTimeout(r, 100));
23 return file;
24 }
25
26 runner.test("editorManager.editor exists", (test) => {
27 test.assert(
28 typeof editorManager !== "undefined",
29 "editorManager should exist",
30 );
31 test.assert(
32 editorManager.editor != null,
33 "editorManager.editor should exist",
34 );
35 });
36
37 runner.test("editorManager isCodeMirror flag", (test) => {
38 test.assertEqual(editorManager.isCodeMirror, true);
39 });
40
41 runner.test("editor.getValue()", (test) => {
42 const editor = getEditor();
43 test.assert(
44 typeof editor.getValue === "function",
45 "getValue should be a function",
46 );
47 const value = editor.getValue();
48 test.assert(typeof value === "string", "getValue should return string");
49 });
50
51 runner.test("editor.insert()", (test) => {
52 const editor = getEditor();
53 test.assert(
54 typeof editor.insert === "function",
55 "insert should be a function",
56 );
57 });
58
59 runner.test("editor.getCursorPosition()", (test) => {
60 const editor = getEditor();
61 test.assert(
62 typeof editor.getCursorPosition === "function",
63 "getCursorPosition should exist",
64 );
65 const pos = editor.getCursorPosition();
66 test.assert(typeof pos.row === "number", "row should be number");

Callers

nothing calls this directly

Calls 5

getEditorFunction · 0.85
createTestFileFunction · 0.85
requireMethod · 0.80
removeMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected